Every investor makes mistakes, even the great ones like Warren Buffett.

Over his long investing career, the Berkshire Hathaway (BRK.A 0.97%) (BRK.B 1.19%) chief has had plenty of bad buys and missed opportunities. Of those, one of the biggest was not buying Amazon (AMZN -2.72%) earlier. Buffett has acknowledged this mistake in the past, saying at Berkshire's 2018 shareholder meeting that he made the wrong decision not buying Amazon (or Alphabet).

Buffett has also expressed his admiration for Amazon Founder Jeff Bezos on more than one occasion, saying, "I had [a] very very very high opinion of Jeff's ability when I first met him, and I underestimated him."

Berkshire Hathaway chief Warren Buffett.

Image source: The Motley Fool.

Buffett would soon correct that mistake, buying Amazon stock in 2019, and Berkshire now owns 10.7 million shares valued at roughly $1 billion.

Amazon wasn't one of the conglomerate's most recent buys, but with Amazon stock down 50% from its peak a year ago, this is a great time for Buffett or anyone who follows his investing appraoch to buy shares of Amazon. Here's why Amazon is the perfect Buffett stock to buy right now. 

1. It's got plenty of competitive advantages

Buffett's top criterion for buying a stock is whether it has an "economic moat," his phrase for a sustainable competitive advantage. Buffett favors companies with economic moats because they block out competition and help ensure long-term profits.

Amazon passes this test with flying colors. The company has built a dominant e-commerce business that owns a roughly 40% share of the U.S. market with no close second. That lead is protected by its Prime membership program, which has more than 200 million paying members; a vast network of warehouses that help ensure fast delivery and free returns; and a hard-earned reputation for wide selection, low prices, and excellent customer service.

Amazon's success in e-commerce has enabled it to layer other, more profitable business on top of first-party e-commerce business, including its third-party marketplace, Fulfillment by Amazon, and advertising, which is approaching a run rate of $40 billion in high-margin revenue.

Amazon Web Services, the leading cloud infrastructure business, still benefits from the first-mover advantage it captured. It enjoys huge profits as a result of that leadership, with annual operating income approaching $25 billion.  

2. The valuation is attractive

Buffett looks at the quality of the business before price, but price is a key factor in his decision-making, as he generally aims to buy stocks trading for less than their intrinsic value.

Amazon stock is notoriously difficult to value because of its unique collection of businesses and its focus on long-term value creation, but with the stock down 50% from its all-time high a year ago, there's good reason to think it's undervalued. 

At its current price, Amazon is essentially flat with where it was at the beginning of 2020 before the pandemic started. Its price-to-sales ratio is at an eight-year low, dating back to before it launched AWS as a separate business segment, which showed it was growing quickly and highly profitable.

Additionally, Amazon is making efforts to cut costs, laying off around 10,000 employees, and shuttering unprofitable experiments like Amazon Care and Scout, its autonomous home delivery robot. The company has recognized that it overinvested during the pandemic boom, and has closed or canceled dozens of warehouses as a result. 

There are plenty of areas where the company can scale back on costs, including its international e-commerce business, so it's a good bet Amazon will be significantly more profitable in a year as those efforts begin to bear fruit.

A worker in an Amazon fulfillment center.

Image source: Amazon.

3. Others are fearful

Perhaps Buffett's most famous aphorism is, "Be greedy when others are fearful, and fearful when they are greedy," and right now, fear seems to be the dominant sentiment around Amazon.

Stocks are in a bear market as the Federal Reserve is rapidly raising interest rates to cool off inflation, and investors are steeling themselves for a recession. That's hurting Amazon because its business is largely cyclical. Its e-commerce operation is mostly built around discretionary items that consumers tend to scale back on in tough economic times, unlike rival Walmart which gets most of its revenue from groceries, and AWS is sensitive to business spending and customer demand. 

CFO Brian Olsavsky said on the recent earnings call, "With the ongoing macroeconomic uncertainties, we've seen an uptick in AWS customers focused on controlling costs."

In other words, much of the reason why Amazon stock is down is due to souring market sentiment, and the challenges any cyclical business faces at a time when people are cutting back on spending and businesses are looking to control their budgets.

Once the economy emerges from its current slumber and the stock market bounces back, Amazon is likely to make a robust recovery.