With Target (TGT 0.18%) stock rising following its recent earnings report and Walmart's (WMT -0.08%) falling after its own, it's a good time to examine the two stocks. Is Target stock really the one that should have appreciated this week? After all, the stock looks much cheaper than Walmart's on a valuation basis.

The reality is the two companies are very different from each other. One deserves to trade at a significantly higher premium -- and it's not Target. Here's why I don't think investors should be rushing to buy Target shares.

Only one of the two companies is growing

Glancing at Walmart's and Target's second-quarter earnings releases leads to one clear takeaway: Walmart is growing, and Target is contracting. Walmart's second-quarter revenue rose 5.7% year over year while Target's declined 4.9%. 

It's not surprising that in a high interest rate environment, where the consumer is pressured, Walmart is doing better than Target. The larger of the two big-box retailers relies more on nondiscretionary sales (like groceries) than Target does -- and sales of nondiscretionary items are generally more resilient during economic contractions. But there are notably some bright spots beyond groceries at Walmart as well; in Walmart's second-quarter update, management said that its general merchandise sales trends have been better than management had expected. The company's strength in e-commerce, where sales rose 24% globally, is also worth calling out. Target's e-commerce sales comparatively fell 10.5% over the same period.

Confident in its value proposition, Walmart CEO Doug McMillon said during the company's earnings call that he expects the company will be able to continue growing, even if things get tougher for the consumer, due to Walmart's focus on low prices and value. 

Target, meanwhile, isn't doing so hot. Its year-over-year sales decline comes as management said strength in its nondiscretionary business lines had been offset by weakness in discretionary categories. Further, management said it expected more year-over-year declines in total revenue for both the third quarter and the full year. 

Walmart's business is more resilient

The current market environment does a great job of highlighting why Walmart stock should trade at a higher premium than Target. With more than half of Walmart's annual sales coming from groceries, compared to about 20% of sales coming from groceries at Target, Walmart's business benefits more from consumers' habitual shopping for essential items like eggs, milk, bread, toiletries, and beauty products. As investors can see today, this favorable product mix helps Walmart outperform Target dramatically during an uncertain environment.

Then there's Walmart's Sam's Club -- a membership-based wholesale retailer. Target doesn't have a business like this under its ownership. The membership-based model allows Walmart to collect a consistent stream of membership fees in any market. Even more, Sam's Club can raise its membership fees from time to time. Indeed, it did exactly that late last year. Finally, it's worth noting that Sam's Club derives even more of its total sales from groceries than Walmart stores do. A whopping 63% of Sam's Club's fiscal 2023 sales came from groceries and consumables. On top of this, 17% of its sales were derived from another business segment that helps drive habitual trips to its store: "Fuel, Tobacco and other categories." This product mix makes Sam's Club particularly valuable during times of economic uncertainty. Sam's Club (14% of Walmart's overall sales) is a beneficial asset for Walmart that Target doesn't have -- and it still growing nicely, with its member count in the U.S. climbing at a rate in the mid-single digits year over year during fiscal Q2.

Given Walmart's resilient model and its valuable Sam's Club unit, investors should be willing to pay more for Walmart's earnings than Target's. So next time you think of buying Target over Walmart just because Target's price-to-earnings multiple is 22 and Walmart's is 37, remember that the two businesses are in different leagues.