It was an unexpected turn of events that Walmart (WMT -0.52%) was able to turn in a surprisingly robust quarterly earnings report, but Target (TGT 0.86%) was unable to match the effort. Its own earnings fell woefully short of forecasts.

The retailers are often viewed as somewhat similar given that they are both discount mass-merchandise retailers. But one skews toward deeper discounting and the other to mid-tier retailing, and so their divergent results raised a few eyebrows.

Yet in a period featuring persistently high inflation, a stagnating economy, and fears of a full-blown recession, maybe the outcomes were a foregone conclusion after all.

People grocery shopping.

Image source: Getty Images.

A game of one-upmanship

Over the past decade, Target has been the better stock, gaining 146% in value compared to Walmart's 120%. However, both have underperformed the S&P 500, which is up 184% over the last 10 years. Actually, for much of that time, the two retailers tracked each other fairly closely, regularly trading off as to which one was the better investment and seemingly underscoring the similarities of their two businesses.

It wasn't until the COVID-19 pandemic, however, that Target really took off, and it was only then that their difference really stood in stark contrast and explains why Walmart is likely to be the better investment for the foreseeable future.

TGT Chart

TGT data by YCharts

At the onset of the outbreak, although both retailers were declared "essential" businesses and allowed to profit at the expense of their not-so-fortunate competitors, Walmart was the clear favorite as everyone raced to stock up on essentials. Its broad selection of goods and everyday low pricing made it the go-to retailer for millions.

Walmart's comparable-store sales tripled in the first pandemic quarter compared to the prior one, which at the time had been its high-water mark for much of the past decade. As my colleague Demitri Kalogeropoulos noted at the time, Walmart added "nearly $11 billion in incremental revenue in just the last three months." E-commerce sales also soared, rising 74% year over year.

It was only when lockdowns started to ease and shopping patterns started to normalize that Target began to shine. While it was a nominal discount retailer, it was never going to be able to compete on price with Walmart. Instead, having invested heavily in its digital platform prior to the pandemic, and having acquired delivery service Shipt, Target had all the pieces in place to meet consumer demand for the new way of shopping, especially as demand for higher margin items returned.

With a customer base that skews toward higher income, and with a focus on service, Target saw its sales and profits soar. As Travis Hoium noted in that July 2020 article, "Target has been able to leverage its brick-and-mortar stores and curated merchandise to offer a high-value service to customers."

The new, new normal

But that was then; this is now. Inflation is running just under 8%, still at 40-year highs, and the Federal Reserve has pushed interest rates to a 15-year high of between 3.75% and 4.25%, making the cost of borrowing more expensive. It's a hurting economy that is deeply affecting lower-income households, but also increasingly upper-income consumers too.

That was one of the more remarkable takeaways of Walmart's most recent earnings report. While consumers who had been shopping its supercenter centers less frequently were suddenly returning more often, households with incomes of $100,000 or more were also visiting its stores.

Much as at the start of the pandemic, people, when they need to, really stretch their wallets, we're in an economic situation that is strategically similar but could last far longer than the COVID outbreak. It also once again highlights the real difference between Target and Walmart. The former is really a consumer discretionary stock, while the latter is a consumer staple stock. 

In times of economic trouble, consumers will turn to Walmart first because they can get the biggest bang for their buck, not just one general merchandise, but key to its success, on groceries. Meanwhile, Target should rebound, but only when the instance of the crisis has passed and people feel they can spend more freely.

Both retailers are solid businesses, but if we're heading into an extended downturn, as a number of economists suggests is likely, Walmart will be the better bear market bet.