Because of poor weather in Brazil and Colombia, which together account for nearly 40% of world coffee production, Bloomberg is reporting that coffee prices may go up 40% after already jumping 60% in the last year. Already, Kraft (NYSE: KFT) and J.M. Smucker (NYSE: SJM) have increased prices on their respective Maxwell House and Folgers brands several times. Such dramatic increases in the cost of business can be disastrous for a company that can't eat the costs or pass them on to customers, but the right company may be able to come out ahead.

A hard pill to swallow

The first thing a company can do when faced with increased costs is simply to swallow them in order to keep demand up. The most relevant metric to look at is gross margin. It shows us two things: how well margins have held up during previous rough patches, and how much room they have to shrink if need be.

Starbucks (Nasdaq: SBUX) is the clear winner currently, but Peet's Coffee & Tea (Nasdaq: PEET) trails by only about 4 percentage points. It's also worth noting that when coffee prices started exploding in 2008, Starbucks' margins began falling while Peet's actually rose somewhat. This was a tough time for Starbucks, and like many others, the company went through a restructuring phase, and its margins have improved considerably.

Also of note is Green Mountain Coffee Roasters (Nasdaq: GMCR), whose margins have been gradually weakening. Much of this can be blamed on Green Mountain's habit of essentially giving its Keurig coffee makers away to drive adoption of its K-Cup products, in much the same way Amazon sells dirt cheap Kindles to drive its more profitable e-book sales. The decline signals that Green Mountain may not be getting as much out of that strategy as it used to.

Net profit margins tell us a different story. Here, Starbucks still generally beats its peers, but McDonald's (NYSE: MCD) dominates, and has been showing gradual improvement over the years, by boosting gross margin and cutting SG&A expenses as a percentage of revenue.

Sharing the load
Passing costs on to customers is often an easier way to maintain profitability, especially if you can point to general inflation (blaming speculators never hurts either).

The trade-off, of course, is that higher prices may weaken sales. A company with strong sales growth can be expected to hold demand up better than one with weak or declining growth. In this instance, Green Mountain is like a freight train filled with coffee beans, except the beans are actually the spice Melange and the train is a giant iPad. Green Mountain's revenue growth in this time has been twice that of Apple, for perspective. Panera Bread (Nasdaq: PNRA) is the closest competitor, at just a small fraction of its growth.

It would seem like Green Mountain can most capably pass costs on to its customers, who seem ravenous for its products. But this doesn't necessarily make it the best of breed. Green Mountain receives an 'F' on Motley Fool Big Short's proprietary earnings quality rating system, and with good reason. Much of the company's growth has come from debt-fueled acquisitions, and the difference between its net income, which can be subtly manipulated, and its free cash flow, which is harder to manipulate, has been growing.

And the winner is ...
The winner here is hard to call. Starbucks has been showing strong margin improvement, but its revenue growth has been lackluster. Green Mountain's growth blows the green mermaid out of the water, and it's certainly made a lot of money for Rule Breakers subscribers, but it's hard to say how much of the company's growth has been demand-driven and not acquisition-driven. Given the weak economy, it may just come down to whoever can be the cheapest, swinging things in McDonald's favor.