Due in part to a pig virus, historically small cattle herds and a Brazilian drought, grocery shoppers everywhere have been feeling pain at the checkout. But there could be a silver lining, at least for the restaurant industry, according to one firm.
The reason? When grocery prices rise faster than the cost of food elsewhere, restaurants typically benefit as their relative value improves modestly, according to Bernstein Research.
"When agricultural inflation is going up, it means costs in general are going to rise faster for the food-at-home sector than restaurants," said Alexia Howard, an analyst at Bernstein. "And that's going to disproportionately push input costs for food-at-home products higher and traffic up for the restaurant sector." Input costs are expenses for material and labor related to production of goods.
One of the most important drivers of choosing whether to cook at home or to dine out is this relative price of food at home vs. food away from home.
For the year ended in May, prices of food away from home ticked up 2.2 percent while the grocery price metric of food at home rose 2.7 percent, according to the Consumer Price Index.
This is a reversal of prior trends for this metric. Grocery inflation had been lower for most of 2012 and all of 2013 before flipping in May.
Bernstein expects the trend to accelerate. The firm's analysts forecast food-at-home inflation will rise to about 3.5 percent through the back half of the year while food-away-from-home inflation ticks up to around 2.5 percent.
Since higher grocery prices lead to lower discretionary spending, Bernstein expects food-at-home inflation to be "more unambiguously positive for restaurants with more affluent customers like fast casuals" and specialty coffee chains, such as Chipotle, Panera Bread and Starbucks. Chains that specialize in high-inflationary products, like steak, are also set to benefit.
Complicating the situation, though, are input costs that aren't rising uniformly and the fierce competition among processed food makers that could result in additional promotions. Because of this, the impact for restaurants is "not as clear cut this time around," said another Bernstein analyst Sara Senatore.
RBC Capital Markets analyst David Palmer expects a modest acceleration in food-at-home inflation, which he views as a "modest positive for the fast food industry and a slight negative for casual dining," which has bigger input costs and less pricing power due to higher check averages.
"If it turns out to be a real turn in food inflation that's sustainable, it's something that would be a real positive for the fast food industry because there's a roughly 75 percent correlation of fast food industry same-store sales to at-home food inflation," Palmer said.
But isn't a restaurant meal price still much more expensive than a home-cooked one?
Often, but price isn't the only factor customers consider. Senatore stressed that while the prices are still not comparable, "the point is in periods of inflation you see that gap narrow a bit."
"Accounting for the cost of the time spent preparing a meal at home narrows the gap substantially and helps explains why seemingly modest changes in pricing can change how the 'share of stomach' is allocated," wrote Bernstein analysts.
Not everyone buys the argument.
Steve West, a restaurant analyst at ITG Investment Research, said he doesn't think the divergence will result in "much change."
"There would be a lag for months and months before the consumer would realize that the restaurant bill wasn't as much relative to the grocery bill," West said.
What shoppers do notice, West said, is that their grocery bill is much higher.
"That just takes more and more out of their wallet that they could defer to restaurants spending," he added. "I don't buy into this theory that consumers notice the gap. Consumers don't notice the gap. They're paying attention to how much money is in their wallet."
—By CNBC's Katie Little