There's no such thing as a stock that wins all of the time; even history's best stock market winners have had periods where the stock did nothing or may have even significantly trailed the market.

Retailer Walmart (WMT -0.91%) is a historic winner, minting millionaires for the past several decades. Over the past five years, this value stock has performed well, rising 93% (compared to the S&P 500's 83.5% return). The stock price rise is partly thanks to a pandemic-related boost but also to a ramp-up in its omnichannel operations.

But Walmart hasn't been winning much lately; the stock is roughly the same price as a year ago (up about 2.9%). And unfortunately, it's looking like this holding pattern isn't going away any time soon. Here's why Walmart stock could continue to be "dead money" for a while yet.

Person browsing TVs at a retail store.

Image source: Getty Images.

The stock has an inflated price tag

The first, most apparent problem with Walmart's stock is that the valuation has become too hot. Shares have averaged a price-to-earnings ratio of 16 over the past decade but are currently at 21, using Walmart's earnings per share (EPS) for the fiscal year ending Jan. 31, 2022, of $6.46. There's a roughly 30% difference between the stock's historical valuation and where it's at today.

The core question in this situation becomes whether the stock deserves this premium valuation or if the company's fundamentals will eventually push the valuation back down to its appropriate level. Nobody can tell you for sure what might happen overnight, but there are clues that the stock may struggle to justify a higher P/E ratio.

Tough margins in a challenging business

Walmart, a massive company, did an incredible $573 billion in revenue in its fiscal year 2022 ending Jan. 31, 2022. It's one of the largest companies on Earth, yet its free cash flow in fiscal 2022 was just $11 billion, or just under 2% of revenue.

On the one hand, Walmart's competitive moat is its massive size and scale, squeezing competition out of the market because it can acquire and sell goods for less money than everybody else. However, it's common for very low-margin businesses to trade at discounted valuations because there could be more risk, and the company has to "do more" to come up with the same profit as a higher-margin business.

In other words, a company that can turn $1 of revenue into $0.10 of free cash flow could arguably justify a higher valuation than a company that needs $10 of revenue to create the same $0.10.

Can consumer spending remain strong?

Walmart sells a vast range of products, from food to household goods to electronics to apparel. Its business could be impacted by consumer spending habits, given that Walmart's a one-stop-shop for the consumer.

You can see in this chart how the pandemic initially hurt consumer spending in the U.S. but quickly rebounded and resumed growth, thanks mainly to stimulus checks that were issued to keep the economy going during lockdowns.

US Personal Consumption Expenditures Chart

U.S. Personal Consumption Expenditures data by YCharts.

It seems that stimulus checks are in the rearview mirror, and consumers are currently working through a high-inflation environment, pushing the price of goods steadily higher. Slower consumer spending could negatively impact Walmart's growth if consumers reduce spending to compensate for higher prices.

Walmart isn't a high-growth company, growing revenue an average of 2.86% per year over the past decade. I don't think that these potential headwinds are anything Walmart wouldn't work through, but it arguably makes it harder to justify a premium valuation on the stock.

So what might happen?

Nobody can know for sure what will happen tomorrow, but Walmart could eventually revert to its historical P/E ratio average over time. What might returns look like if the stock were to trade at a P/E of 16 five years from now?

Analysts expect the company to grow EPS roughly 5% annually over the next three to five years. If you apply this to the company's $6.46 per share for the year ending Jan. 31, 2022, that's an EPS of $8.24 in five years. Assigning a P/E of 16 would result in a share price of $131.84 -- slightly less than what it currently trades at.

Will this happen? Again, nobody can know for sure, but this is a risk for investors. Expensive stocks can work if the underlying businesses grow fast enough to burn off the premium. However, a slow and steady "glacier" like Walmart has a much harder time justifying a high share price because the business could take years to catch up to the stock. Investors should keep this in mind before paying up for large and mature companies, even if they have a proven history of winning.