Given Amazon's (AMZN -0.09%) dominant position in e-commerce, cloud computing, and its growing advertising business, investors might have expected the company's stock to perform a bit better than its 4.3% return year to date. Amazon trailed the 27.3% return of the S&P 500 index, but history shows that better returns usually follow when great companies see their stock prices underperform. 

The market is focused on the year-over-year growth comparisons with the pandemic in 2020, which makes Amazon's latest earnings results look weak. The online juggernaut reported 15% revenue growth in the third quarter and expects to report top-line growth between 4% and 12% to close out the year. Those numbers are not what investors are used to seeing from the e-commerce leader.

An Amazon employee packing a box in a fulfillment center.

Image source: Amazon.

However, investors should focus on where Amazon is headed over the next five years and beyond. One thing Mr. Market is overlooking, and why Amazon remains my top holding heading into 2022, is Amazon's strong cash position and how it's using that to widen its competitive advantage in the near term.

Follow the cash

The primary concern for the retail industry entering the holiday quarter was supply. Top retailers Costco Wholesale (COST 1.15%), Target (TGT -2.43%), and Walmart (WMT 0.48%) have handled this quite well, with inventories much higher than last year.

Costco might be in the best competitive position among these leading retailers. It reported comp sales growth of 15% in the most recent quarter, faster than Target and Walmart, and on par with Amazon's growth rate. Costco's stock price is up almost 50% year to date. 

But one important advantage Amazon has over these retailers is more cash. It is currently investing aggressively to expand its warehouse capacity and build an unrivaled global transportation fleet to take greater control of its supply chain. CNBC recently reported how Amazon has spent the last few years making its own cargo containers to bypass the bottlenecks at the ports in California.  

This was obviously expensive, but Amazon can afford it. Despite those investments, Amazon ended the third quarter with $79 billion of cash and short-term investments sitting in the bank. It generated $26 billion of free cash flow in 2020. 

In contrast, Walmart generated $24 billion in free cash flow last year, while Costco produced just $6.4 billion. There are not many retailers with Amazon's resources, and that plays to its advantage in the race to conquer the global e-commerce market.

Here's a look at each company's cash position through the end of the most recent quarter.

AMZN Cash and Short Term Investments (Quarterly) Chart

AMZN Cash and Short Term Investments (Quarterly) data by YCharts

Amazon's free cash flow was a negative $2.2 billion through the first nine months of 2021. That's due to a 78% increase in capital spending this year, climbing to $38.9 billion. This might look bad, but it points to profitable growth since Amazon is capable of generating a high return on invested capital. 

AMZN Free Cash Flow Chart

AMZN Free Cash Flow data by YCharts

Amazon has nearly doubled its operational capacity over the last two years to meet demand. In fact, Amazon may be on the verge of applying greater pressure than ever before on its biggest rivals.

Amazon's widening lead in infrastructure

Walmart has one advantage over Amazon, which is a massive 783 million square feet of stores around the U.S. This is a strength in same-day delivery as big blue rolls out Walmart+ to compete with Amazon Prime.  

However, data from MWPVL International shows Amazon continuing to pull away from Walmart in e-commerce operations overall. Amazon is estimated to have 195 million square feet of fulfillment centers in the U.S., and future capital spending could add another 129 million square feet. 

Walmart's total footprint in the U.S. devoted specifically to e-commerce fulfillment is estimated to be just 21 million square feet, with 7 million planned for future use. Costco reports having 31 million total square feet of distribution and logistics facilities during fiscal 2021, but it's unclear how much of that is devoted to e-commerce. 

Investors just need to follow the cash. With relatively limited cash resources, it's difficult to see how Costco and Walmart can ever catch Amazon, especially since the latter has the advantage of padding the cash coffers with high-margin growth from nonretail businesses, such as advertising and Amazon Web Services.

The market is not giving Amazon full credit for these advantages. The stock currently trades at 32 times its cash from operations per share. This is why Amazon is my top stock to buy for 2022.