It was back-to-the-future time for Lifeway Foods (NASDAQ:LWAY) last week.

Consider this line from my column on the company's Q2 2004 earnings: "In the second quarter of 2004, Lifeway experienced a small complication: The price of the main ingredient for its products doubled. Oops." For shareholders, "Oops" probably felt like an understatement, as they watched the value of their investment drop 17% in a day of panicked selling. So it should come as no surprise to Lifeway shareholders that Thursday's 23% collapse had a similar catalyst: a 110% increase in the cost of milk.

Curdling margins
This staggering increase in price for a product that forms a significant portion of Lifeway's cost of goods sold (COGS) curdled what should have been an exceptional quarter of 32% sales growth. But COGS ran laps around sales growth, rising 54% versus Q3 of last year. As a percentage of sales, COGS was a staggering 72% (compared to 62% during the same period in 2006), and gross profit declined more than 1,000 basis points to 27.7%.

With food costs on the rise and milk selling at all-time highs, nearly every restaurant franchise is facing margin pressure. Dairy costs dumped on Kraft (NYSE:KFT) and Dean Foods (NYSE:DF), losing 240 and 640 basis points, respectively, in gross margin. Even Starbucks (NASDAQ:SBUX) experienced less-caffeinated results last week, with dairy costs weighing on the bottom line. Meanwhile, the maker of Yoplait yogurt (but also numerous nondairy foodstuffs), General Mills (NYSE:GIS), managed to gain 40 basis points. So Lifeway appears to be the hardest-hit among companies subject to the dairy drought.

Aside from that, Mrs. Lincoln, how was the play?
The good news is that this was pretty much the extent of the bad news (at least in the income statement). The cash flow statement, which Lifeway inexplicably leaves out of its press releases, shows cash profits running about 75% lower in the first three quarters, compared to the first nine months of last year.

Lifeway is doing its best to mitigate a bad situation by reining in the costs it can control. Marketing costs paced sales growth at 32%. Meanwhile, increasing economies of scale as Lifeway grows helped keep general and administrative expenses growing at half the rate of sales. Such cost controls helped pare the decline in operating margins to about 900 basis points, leaving them at 5.9% for the quarter. Meanwhile, the ever-mysterious line entry for "Gain (loss) on sale of marketable securities" more than doubled in value.

Damage control only goes so far, however. In the end, the firm wound up with a net margin of only 4.8% for the quarter, less than half last year's performance. So why did the shares rebound on Friday? I'm only guessing, but I've got a sneaking suspicion I heard the "slam" of short-sellers closing their positions, followed by the clink of coins as they counted their winnings.

For more on this little kefir maker that could, read:

Starbucks is a Stock Advisor pick, and Kraft is an Income Investor recommendation. Either newsletter is free for 30 days.

Fool contributor Rich Smith does not own shares of any company named above. The Motley Fool's disclosure policy is always in stock.