U.S. Markets open in 2 hrs 50 mins

Better Buy: Amazon.com, Inc. (AMZN) vs. Costco Wholesale Corporation (COST)

Brian Stoffel, The Motley Fool

The advent of e-commerce has left a trail of wreckage and ruins among brick-and-mortar retailers. The key beneficiary has been Amazon (NASDAQ: AMZN), the undisputed king of e-commerce.

But a few of the very best retailers have not only survived, but thrived. Case in point: Costco (NASDAQ: COST) has returned 225% to shareholders over the past seven years, far outpacing the S&P 500's return of 143%.

Will that outperformance continue, or should investors resign themselves to Amazon's growing dominance by buying shares?

A miniature shopping cart with miniature packages sitting on a laptop keyboard

Image source: Getty Images.

Below, we'll attempt to figure out which company's stock is a better buy at today's prices. To do so, we'll evaluate them on three key characteristics.

Financial fortitude

Every long-term, buy-and-hold investor needs to accept the fact that economic crises can and will happen. Whether these crises are macro- or company-specific in nature doesn't matter nearly as much as what the effects on companies will be.

By measuring a company's financial fortitude, we can get a better idea if it is fragile, robust, or antifragile in the face of such crises. You can read more about those designations here.

Bearing in mind that Amazon's market cap is nine times that of Costco, here's how they stack up.

Company

Cash

Debt

Free Cash Flow (FCF)

Amazon

$26 billion

$25 billion

$5 billion

Costco

$7 billion

$6.5 billion

$3.3 billion

Data source: Yahoo! Finance. Cash includes long- and short-term investments. Free cash flow presented on trailing-12-month basis.

These two are actually very evenly matched. Both Amazon and Costco have reasonable debt levels and slightly positive net-cash balances. They also both have very healthy free cash flows.

Relative to size, Costco's free cash flow appears superior, but it's important to remember that Amazon plows much of its cash flow back into capital expenditures to expand its dominance. In the face of an economic downturn, CEO Jeff Bezos could simply take his foot off the spending pedal to shore up free cash flow.

Overall, I consider both companies to be robust in the face of a crisis -- not necessarily benefiting from them over the long run, but easily being able to survive.

Winner = Tie.

Valuation

Next, we have to determine which company's stock is more expensive. Unlike comparing a new gadget's price side-by-side against the competition, there's no single variable that can tell us how "expensive" a stock is. There are, however, a number of different data points we can consult.

Here are five of my favorites:

Company

P/E

P/FCF

PEG Ratio

Dividend Yield

FCF Payout

Amazon

274

169

5.1

N/A

N/A

Costco

32

28

2.5

1.1%

26%

Data source: Yahoo! Finance, E*Trade. P/E calculated using non-GAAP earnings when applicable.

On this facet, we have a clear winner: Costco. Not only is the stock markedly cheaper than Amazon on every metric, it also offers a quarterly dividend that has lots of room for growth, to boot.

This shouldn't be terribly surprising. Amazon's practice of reinvesting the bulk of its sales into growth opportunities has almost always led to depressed earnings, which makes its P/E ratio skyrocket.

Winner = Costco.

Sustainable competitive advantages

No characteristic of a company is more important to evaluate than the sustainability of its competitive advantage -- or moat. Over the long run, nothing plays a more powerful role in a stock's returns than this.

Costco has two primary moats. The first is the value of its brand: After decades of Costco providing reliably low-priced goods and solid customer service, North Americans trust the company. According to Brand Finance, Costco's brand ranks 53rd in the U.S., worth $12 billion.

The other moat comes via low-cost production. If Costco didn't charge annual membership fees, the company would barely be profitable. Its membership income nearly equals its pretax profit, meaning that everything else is sold at the thinnest of margins. The important part of the strategy is that it would be nearly impossible for anyone to beat Costco on prices given this business model.

But Amazon's moat -- in my opinion -- is even wider than Costco's. The same Brand Finance ranking gives Amazon the top spot in America -- its brand being valued at $150 billion. In addition, Amazon also benefits from low-cost production: the company's network of fulfillment centers guarantees quicker delivery at a lower internal cost than any other company on earth can guarantee.

It doesn't stop there, though. Amazon also benefits from enormous network effects. Because the website has become the go-to destination for shoppers, third-party vendors are incentivized to list their wares on Amazon and use Fulfillment by Amazon to complete the orders. That draws in even more shoppers, which draws even more vendors. It's a virtuous cycle that Costco cannot match.

Winner = Amazon.

And my winner is...

So there you have it. On the surface it's a tie: Both companies have solid balance sheets, but Costco has the more favorable valuation, while Amazon has the wider moat. When such ties happen, I always side with the company with the wider moat. In this case: Amazon.

In my own life, however, there's a much wider gulf between the two companies. While I don't own any Costco stock, Amazon is my largest holding -- comprising over 20% of my real-life holdings. Additionally, while I have an outperform rating on Amazon on my CAPS profile, I've bet that Costco would underperform the S&P 500. That's because the company has to rely almost exclusively on membership fee increases to grow earnings. While there's nothing wrong with that, I feel like a stock trading for over 30 times earnings is too rich given this dynamic.

With Amazon aggressively reinvesting in itself, on the other hand, I think traditional valuation metrics go out the window. Its uberwide-and-growing moat makes it impossible to know for sure what earnings could look like 10 years from now. That's why my money is on Amazon in this competition.

More From The Motley Fool

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Brian Stoffel owns shares of Amazon. The Motley Fool owns shares of and recommends Amazon. The Motley Fool recommends Costco Wholesale. The Motley Fool has a disclosure policy.