Over the past month, Costco Wholesale (COST -0.55%), Target (TGT 1.28%), and Walmart (WMT -0.65%) have seen their share prices fall over 25% -- far worse than the 12.5% decline in the S&P 500 or even the 15.6% drop in the Nasdaq Composite over that time frame. These companies tend to be steady performers and reliable dividend stocks. So what's going on?

The sell-off stems from broader market volatility, valuation concerns, and weak guidance from Target and Walmart that suggests these companies will face increased margin pressure if inflation remains out of control. The good news is that investors waiting to scoop up shares of these well-known businesses can now do so for a cheaper price.

Let's break down where each company is and where it could be headed from here to determine if Costco is the better buy or if investors could do well with a 50/50 split of Target and Walmart.

A child throws their hands up in glee as two adults push them in a shopping cart through a parking lot.

Image source: Getty Images.

The case for Costco

Costco is a fascinating business for several reasons. For starters, it generates subscription revenue while barely making any money on the products it sells. The company's margins are so razor-thin that they are even less than Walmart's -- which is hard to believe.

COST Operating Margin (TTM) Chart

COST Operating Margin (TTM) data by YCharts

Low margins are typically not a recipe for success. To get away with low margins, a company has to either sell so much volume that it still makes a lot of profit (like Walmart) or grow quickly. To Costco's credit, it is doing both.

COST Revenue (TTM) Chart

COST Revenue (TTM) data by YCharts

Target grew revenue at a faster clip than Costco over the past five years. But Costco grew profits faster than Target. So at least for now, Costco's low-margin business hasn't been an issue. And although its ordinary dividend yield is just 0.9%, Costco has been known to pay sizable special dividends

With shares down 31% in the last month, Costco stock may look attractive at first glance.

COST Chart

COST data by YCharts

The case for Walmart and Target

I think a 50/50 split of Walmart and Target stock is quite a bit better than simply buying Costco right now. The biggest reason comes down to valuation.

COST PE Ratio (Forward) Chart

COST PE Ratio (Forward) data by YCharts

Even after the sell-off, Costco stock's forward price-to-earnings ratio is significantly above Target's and Walmart's and above the S&P 500 average of roughly 18 (and that estimate assumes much higher earnings growth than Costco will probably get).

In addition, Target has posted impressive growth, especially from e-commerce. While its growth may not be as fast as Costco's, it's certainly much better than Walmart's. What's more, Target's operating margin of over 8% gives the company a cushion in case inflation persists. In its first-quarter 2022 earnings call, Target said it expects to maintain an operating margin of at least 8% over the long term. But it posted just a 5.3% operating margin in Q1 and is guiding for a 6% operating margin for the full year. Target is forecasting over $1 billion in higher-than-expected freight costs alone for 2022.

Therefore, it makes sense that the stock price should come down in the short term. But Target is a Dividend Aristocrat, which is a member of the S&P 500 that has paid and raised its dividend for at least 25 consecutive years. Target stock has a dividend yield of 2.2% at the time of this writing.

Walmart may not have the growth of Costco or Target. But it does have a product mix that is less discretionary in nature. Walmart's current mission statement is "to save people money so they can live better." Since its inception, Walmart has focused on offering consumers the lowest prices on goods that they need. That makes Walmart a natural winner during a recession.

However, inflation has hit it hard through supply-chain challenges, higher freight costs, and higher costs of goods. Walmart's already low margins will likely be strained. But Walmart is likely the all-around best value of the three companies, even though it has a higher forward P/E ratio than Target, because its business would suffer the least impact during a full-blown recession. Walmart also sports a dividend yield of 1.9%.

An attractive buying opportunity

Buying equal parts of Target and Walmart is an interesting proposition right now. Neither company is immune to market challenges. But both are also Dividend Aristocrats that have been through many economic cycles in the past. Through it all, they've been able to grow their dividends time and time again. Both companies have done a good job expanding into e-commerce and are certainly better positioned than the vast majority of retailers.

Plus, investors can count on Target and Walmart being around for decades to come. The same could be said for Costco. But again, the big difference here is valuation and product mix. Costco's premium valuation is dependent on sustaining an industry-beating growth rate. If that growth compresses, Costco stock will begin to look overpriced. Reading the tea leaves, there's an argument that Costco is overpriced as we speak. Its P/E ratio is more than double Target's even though Target's growth is also fairly decent. Both Costco and Target offer many discretionary products that are likely to see decreased demand in an economic slowdown. It's just that Target stock already looks cheap right now whereas Costco stock looks expensive.

No one knows how bad the stock market sell-off will get. But as inflation cools and margins return to normal -- whether that's in one year, three years, or whenever -- Target and Walmart stock are going to look simply too cheap to ignore.

No matter how you slice it, it's hard to envision an outcome where Target and Walmart aren't larger businesses five or 10 years from now than they are today. Costco will also probably be a larger business five or 10 years from now. But it could easily underperform Target and Walmart over that time if its growth slips closer to Target's pace. Costco could also have a hard time supporting special dividends if its growth slows, which could result in far less passive income production relative to Target and Walmart.  

Target and Walmart complement each other's strengths and fill in each other's weaknesses -- making them an attractive duo that is better than only buying one or the other.