Over the past year, many stocks crumbled as inflation, rising interest rates, and other macro headwinds drove away the bulls. However, plenty of defensive blue-chip stocks -- especially those with recession-resistant businesses-- survived that sell-off.

One of those survivors was Costco Wholesale (COST 1.01%), which usually attracts a steady stream of shoppers during economic downturns. Customers often buy their products in bulk to save cash during tougher times, and Costco locks them in with its annual memberships. Costco also sells cheaper gas than many stand-alone stations.

Two people shop together at a warehouse retailer.

Image source: Getty Images.

Therefore, Costco seems like the right stock to buy if you're bracing for a painful recession. That's why its shares rose 6% over the past 12 months as the S&P 500 declined 16%. But is Costco really an ideal bear market buy? 

Costco's core strengths

Costco is better insulated from inflation than many other brick-and-mortar retailers because it generates most of its profits from its membership fees instead of its merchandise sales. This business model enables it to subsidize its lower-margin product sales with its higher-margin membership fees.

Its sales of bulk products and the scale of its warehouse stores also enable it operate more efficiently than smaller retailers. That combination of sticky memberships and scale prevents Costco from being disrupted by e-commerce giants like Amazon (AMZN 1.30%), superstores like Walmart (WMT -1.75%), and traditional supermarkets.

As many brick-and-mortar retailers withered throughout the retail apocalypse, Costco's warehouse count rose from 573 at the end of fiscal 2010 (which ended in August of the calendar year) to 838 at the end of fiscal 2022. Its annual revenue grew from $76.3 billion to $222.7 billion during that period, representing a 12-year compound annual growth rate (CAGR) of 9.3%, while its net income increased at a CAGR of 13.3%.

During those 12 years, Costco's total number of cardholders more than doubled from 58 million to nearly 119 million. It also ended the fourth quarter of 2022 with an impressive worldwide renewal rate of 90.4%. In the U.S. and Canada -- home to more than 80% of its warehouses -- that rate came in at 92.6%.

As for inflation or a potential recession, Costco's management believes it can offset that pressure by hiking its membership fees, which it has regularly done every five to six years. Based on that pattern, it might raise its fees again next year. That pricing power makes Costco comparable to Amazon, which also locks in its shoppers with its sticky Prime subscriptions.

Costco's biggest weakness

Costco's main weakness is its valuation. Analysts currently expect its revenue and earnings to rise 8% and 11%, respectively, in fiscal 2023. Based on those expectations, it trades at 32 times forward earnings -- which is arguably too pricey relative to its growth rates and those of its industry peers.

For example, the athleisure apparel retailer Lululemon (LULU 0.80%) is expected to grow both its revenue and earnings by about 27% this year. Yet that high-growth retail stock only trades at 30 times forward earnings.

Walmart, which competes against Costco with its Sam's Club warehouse stores, is growing at a slower clip but trades at just 22 times forward earnings. Costco's smaller warehouse competitor BJ's Wholesale (BJ 1.22%), which is expected to generate double-digit sales and earnings growth this year, has an even lower forward multiple of 21.

Therefore, the flight to safety in this bear market has arguably inflated Costco's valuations to unattractive levels. Five years ago, Costco's stock traded at just $164 a share -- or 23 times the diluted EPS it would generate in fiscal 2017.

To trade at 23 times forward earnings again, Costco's stock would need to drop about 30% from its current levels. That could happen if the macro headwinds wane and investors rotate toward riskier growth stocks again.

Is Costco a good bear market buy?

Costco is a sound long-term investment, but it's too late to buy the stock as a defensive bear market play. Too many investors already flocked to the stock during the pandemic and the subsequent spike in inflation, and it's now historically overvalued. Its low forward yield of 0.8% also won't provide much downside protection as interest rates rise.

For now, investors should stick to cheaper stocks until the macro situation improves. When that finally happens, Costco's stock could ironically decline -- and present a much better buying opportunity -- as other beaten-down stocks bounce back.