Shares of Boeing (BA 0.39%) slumped as much as 12% on Thursday, ending the day down 7%, after Bloomberg reported that the SEC was investigating its accounting for the 747 and 787 aircraft programs. This news piled onto existing investor fears about the health of Boeing's business. Boeing stock has now fallen by more than 30% since peaking in early 2015.

BA Chart

Boeing Stock Performance. Data by YCharts.

However, the issues that the SEC appears to be investigating are not new. The ongoing debate about Boeing's accounting assumptions has been one of the main things holding back Boeing stock in the past few years, even as orders and deliveries have surged. As a result, this may be a good time to act on the Warren Buffett maxim: "Be greedy when others are fearful."

Program accounting: it's complicated
Boeing's use of program accounting is the underlying reason for the SEC's investigation. When a new aircraft type is introduced, the first planes produced are usually built at a steep loss. Over the life of the aircraft program, production costs decline, allowing the aircraft manufacturer to eventually recoup those early losses.

Under program accounting rules, Boeing is allowed to estimate its average profit margin over a multiyear period and apply that to each individual delivery. This allows it to report relatively consistent profits each year, rather than posting big losses in the first few years of production followed by big profits in later years.

Program accounting inherently requires Boeing to make assumptions about future unit sales, average selling prices, and production costs. There's no way to avoid making judgment calls. This extends to decisions about whether the initial losses might be unrecoverable -- which would require a writedown, known as a reach-forward loss.

The SEC checks Boeing's math
The SEC is apparently focusing its investigation on the 747-8 and 787 aircraft programs, both of which have faced significant problems. Regulators are probably worried that Boeing has been too slow to record reach-forward losses on these two programs.

Boeing has lost tens of billions of dollars on the Dreamliner thus far. Image source: Boeing.

Indeed, the accumulated losses for the 787 Dreamliner are particularly high. These so-called deferred production costs are expected to peak around $29 billion later this year. Some aerospace analysts doubt Boeing will ever recover these losses.

Where's the risk?
From an investment perspective, the 747-8 is simply not important enough to Boeing to be a big risk. Boeing has already taken multiple writedowns on this program, including a special charge announced just last month. Even before the most recent writedown, deferred production costs for the 747-8 program were less than $2 billion.

By contrast, if Boeing can't recover its nearly $29 billion in 787 deferred production costs, it would have a much bigger impact on Boeing stock. Based on the current 1,300-unit 787 accounting block, Boeing needs to produce an average cash profit of about $40 million for its 787 deliveries between 2017 and early 2022 (when it is likely to deliver the 1,300th Dreamliner).

This requires extremely aggressive cost-reduction assumptions. There is a good chance that Boeing will be unable to drive down costs fast enough to recoup all of its 787 deferred production costs by early 2022.

So does this mean that Boeing should have already taken a reach-forward loss? Perhaps. However, Boeing is likely to sell far more than 1,300 Dreamliners over the program's lifetime. Indeed, it has already booked more than 1,100 firm orders and is essentially sold out through 2020.

The 787 has a huge order backlog due strong customer demand. Image source: Boeing.

By 2022, the 787 program will probably be producing at least $5 billion of cash profit annually. This means that even if Boeing were to fall $10 billion short of breakeven over the first 1,300 787 deliveries, it would just take an extra two years to recoup its remaining deferred production costs. Dreamliners delivered after that would add significantly to the program's profitability.

What's done is done
There's no question that the 747-8 and 787 aircraft programs have been failures for Boeing. The company has already taken writedowns on the 747-8, conceding that the program won't turn a profit.

As for the 787, Boeing should be able to recoup its deferred production costs eventually. At some point further down the road, it should also recover the massive R&D costs it incurred to develop the Dreamliner. However, the rate of return on these upfront costs will be extremely low.

Yet all of these upfront costs have already been paid. They are sunk costs. By the end of 2016, Boeing will be earning a (cash) profit on every 787 it sells -- the only question is just how high this cash profit will be.

Boeing expects to produce $10 billion in operating cash flow in 2016, with lots of room for growth over the next five years or so. Yet Boeing's stock slump has cut its market cap to just $72 billion. This makes Boeing stock extremely cheap.

If the stock price remains depressed throughout 2016, Boeing could potentially buy back about 10% of its shares this year. This should drive strong EPS growth in 2017. Moreover, Boeing's dividend yield has now reached 4%. All this adds up to a great opportunity to buy Boeing stock and then wait patiently for the company to churn out rising cash flow in the years ahead.