The inflation problem is real. According to the American Automobile Association (AAA), the average price for a gallon of gas is $4.96 compared to just $3.07 last year. And this 61% year-over-year increase has real ramifications on everyday wallets. For example, it costs more to drive to work. And it costs more for grocery stores to receive food shipments, causing end-consumer prices to go up. These inflation problems and others are costing average U.S. households more than $400 per month, according to Moody's Analytics senior economist Ryan Sweet.

If consumers spend $400 more a month on things that they need, then they'll necessarily make cuts elsewhere to keep their heads above water. In short, the longer inflation lasts, the greater the odds that it will hurt businesses. For this reason, it's important for investors to consider stocks that can still grow earnings in an inflationary environment. And Sanderson Farms (SAFM), Tractor Supply (TSCO 0.85%), and eBay (EBAY -0.14%) are three such companies. Here's why.

1. Sanderson Farms: Food spend is essential

If you came to this article expecting a discussion of revenue growth, I'm sorry to disappoint you. Sanderson Farms is the third-largest poultry producer in the U.S. and is unlikely to grow its top line very much. In terms of pounds of chicken processed in past years, the top line only grew between 2% and 5% annually from 2018 through 2020. And the company didn't increase the amount of chicken it processed at all in 2021. 

Sanderson Farms is an inflation-proof investment because it sells a must-have product: food. Consumers will continue to purchase necessities like chicken and maybe even with increased frequency in 2022. According to a June survey from Morning Consult, a head-turning 84% of consumers say they're eating at restaurants less often due to inflation.

In short, Sanderson Farms' products will likely stay in demand for a long, long time. And while it might not be the fastest revenue-growth story, don't overlook its earnings potential. The company is consistently profitable, as you would expect. And management in the past has rewarded shareholders with share repurchases. It hasn't bought many shares lately, but it's currently authorized to buy 2 million, or about 9% of shares outstanding.

Food stocks like Sanderson Farms may not be at the cutting edge of innovation. But our goal as investors is to beat the market. And, including dividends, Sanderson Farms stock has beat the S&P 500 average over the past three, five, and 10 years. And I expect it to continue to perform well with or without inflation.

2. Tractor Supply: A history of strong performance in uncertain times

As already noted, inflation is red-hot. To reign it in, Federal monetary policy has shifted, and interest rates are going up. This is designed to slow the economy, but it could lead to an economic recession, giving the U.S. an odd situation called stagflation -- inflation and recession at the same time. And if we're headed for a recession, then you might consider Tractor Supply because it proved its merit during the Great Recession.

It's not immediately obvious but, like Sanderson Farms, Tractor Supply sells many must-have products. Sales for livestock and pets account for 47% of overall company sales. And whether you're a hobby farmer, a single pet owner, or have a large number of animals, you're going to keep spending to keep them fed and healthy. If households cut budgets because of inflation, cuts will likely happen elsewhere than in supplies for livestock and pets.

I believe Tractor Supply can perform well during a recessionary period partly because it did perform well during the Great Recession, as the following chart shows.

TSCO Revenue (TTM) Chart

Chart shows revenue and net income from January 2005 through December 2010. Recession shaded with gray. TSCO Revenue (TTM) data by YCharts.

Tractor Supply grew revenue throughout the Great Recession because it was opening new stores, not because customers were spending more. However, average sales per location in 2009 were only 5% lower than in 2007, showing how resilient this business is during tough times.

Of these three companies, Tractor Supply is the most susceptible to inflation in the near term. The cost of its products and the cost of shipping are rising, and the company may not be able to pass these costs on to consumers fast enough. This would result in a temporary hit to its profits margins, similar to how profits fell in 2008 and 2009. It's certainly something to be aware of. But eventually, retailers like Tractor Supply work this out by raising prices, bringing margins back in line with historical levels. 

That said, foreseeing a hit to profitability for Tractor Supply is still speculative on my part. For its part, management is predicting record net income this year of over $1 billion, which is not bad for a company with a market capitalization of just $21 billion.

3. eBay: Surprisingly resilient 

This article is about inflation-proof stocks you can hold forever. It's relatively easy to make a "forever" pitch with more timeless ideas like Sanderson Farms and Tractor Supply. It's much harder to make this case for eBay. But it's the most inflation-proof stock on this list.

eBay doesn't sell physical products. Rather, it primarily provides a marketplace that connects sellers with bargain hunters. By simply being the middle-party, eBay's profits are stellar -- the company's gross margin was 75% in 2021 and 72% for the first quarter of 2022. 

eBay is simply generating revenue with a take rate -- it's cut of sales. If sellers need to increase prices due to inflation, eBay's revenue will increase because it's taking a fixed percentage of the transaction. Moreover, as consumer budgets get squeezed, they'll be more inclined to bargain shop. And eBay's platform has a reputation for having good deals. Therefore, eBay's marketplace seems well poised for both the inflation and recession mix that potential stagflation could bring.

As I said about Tractor Supply, my hunch about how eBay's business would perform in stagflation is supported by how it performed during the Great Recession.

EBAY Revenue (TTM) Chart

Chart shows revenue and net income from January 2005 through December 2010. Recession shaded with gray. EBAY Revenue (TTM) data by YCharts

As a more mature company, eBay isn't a revenue-growth story; management expects a 3% to 6% year-over-year drop in full-year 2022 organic revenue when adjusting for currency fluctuations. However, it is an earnings-per-share (EPS) growth story. Consider that over the past five years, management has repurchased roughly half of its outstanding shares. And it has billions of dollars on the balance sheet and billions more in annual profits, providing ammunition for future repurchases that will boost EPS.

Often overlooked, eBay is still an e-commerce titan. Founded in 1995, it survived the dot-com crash. And today, it's still a top-15 global e-commerce marketplace by sales volume, showing it's surprisingly resilient for an overlooked company nearly 30 years old. Having endured so much to this point, it's reasonable to assume it can keep chugging along for the foreseeable future. So maybe it is a forever stock after all. And as long as the business continues to appeal to a large number of consumers, I expect the EPS growth to continue, leading to market-beating returns.

Don't sit on the sidelines

There are always problems in the economy. Investors can't sit on the sidelines hoping for the day when everything in the outlook looks sunny. That day never comes. Understanding things like inflation and stagflation are important. But there are still good stocks to buy even when things look bad. I believe Sanderson Farms, Tractor Supply, and eBay are good buys today, especially in light of the economic challenges we see. For the curious, there are plenty more ideas out there as well just waiting to be discovered.