Source: Starbucks

The last time you visited your local Starbucks (SBUX 0.69%), it wasn't a cashier's fat finger that spiked up the price of your morning cup of Joe. Yup, you guessed it--Starbucks has raised coffee prices yet again.

Common sense would lead one to believe that in such a scenario, both Starbucks and customers alike stand to lose. Yet, believe it or not, Starbucks may actually gain from the recent increase in the price of its centerpiece commodity thanks to the company's skillful maneuvering.

Brazil attracts America's attention in a way other than soccer
The rally in coffee prices began with the start of the new year. After bottoming out at around $2.70 per kg, the price touched as high as $5 before taking a breather. As of last count, the price sat at around $4.40.

This massive rally was headed off by a drought in Brazil, during which Brazilian coffee farmers suffered through the driest and hottest start to a year in six decades.

In the face of such a rise, on June 24 Starbucks officially announced that it will be raising the price of some of its drinks by $0.05-$0.20, while the price of the packaged coffee Starbucks sells to grocery stores will be increased by $1.

Why this price increase really isn't even about this recent rise
What most naturally assume is that such a price increase is a result of the dramatic ascent of the price of coffee. But, is it really?

In its press release, Starbucks failed to specifically cite the rally in coffee as the reason why it's raising prices. In fact, on the company's own second-quarter conference call, CEO Howard Schultz said this in regard to Starbucks' exposure to rising coffee prices:

Our coffee needs are virtually locked for 2014 and more than 40% locked for fiscal '15 at prices slightly favorable to 2014. So, while coffee prices remain volatile, bouncing back up to [more than] $2 per pound this week, our strategic coffee buying practices have insulated us from an impact this year.

Starbucks is completely insulated from the effects of rising coffee prices, not only through year-end but nearly halfway through 2015! Management realizes that everyone else is raising prices, including its most direct competitor Dunkin' Brands (DNKN), and this provides the justification to raise prices.

The beauty in all this is that Starbucks knows that this move is very unlikely to hurt the company. Starbucks recognizes how loyal its customer base is; it also knows that the type of customer who goes to Starbucks has been, and will continue to be, willing to pay a premium price for the premium products the company has to offer.

The last time Starbucks raised prices was roughly a year ago, in June 2013. In the quarter that the price hikes took effect, the third quarter, Starbucks reported year- over-year comparable-same-store sales of 9%. Not much of a fallout if you ask me.

Furthermore, under this strategy, if coffee prices keep rising past the 40% of 2015 that is covered and Starbucks is forced to sign into contracts at higher levels, the company already has a built-in margin cushion that it can employ before considering another price bump-up.

Such a strategy carries much more risk for competitor Dunkin', however, which also has recently turned to price increases. Dunkin', a company that already acknowledged that customer traffic "isn't great" during its first quarter conference call, serves to potentially lose much more with a more economical customer base. It is worth noting, however, that Dunkin' also is insulated through the rest of this year.

The Foolish takeaway
If you asked 100 people what the worst thing that could happen to Starbucks that is outside of its control is, I bet at least half would respond with coffee prices rising. But, as Starbucks investors would hope, management is prepared and is now actually using the rising cost of the bean to their benefit, setting Starbucks up perfectly to achieve its 2014 goal of improving the operating margin by 175 to 200 basis points.

We will get a checkup on how Starbucks is faring on July 24 when the company reports third-quarter earnings.