In 1994, Jeff Bezos left his job at a quantitative hedge fund after coming across a staggering statistic: Internet usage was growing at 2,300% per year. That inspired him to start an online store -- Bezos started with books because they offered more choice than any other product category -- and he founded Amazon (AMZN -2.56%) in the garage of a three-bedroom house in Bellevue, Washington.

Amazon eventually expanded beyond books, earning a reputation as the "everything store," and Bezos took the company public on May 15, 1997. The stock has since soared more than 117,000%, which equates to an astonishing return of 32% annually over the last 25 years. Put another way, if you had invested $1,000 in Amazon stock at its IPO, it would be worth more than $1.1 million today.

That said, Amazon has fallen on hard times recently. High inflation has weighed on its bottom line, leading to a GAAP loss in the first and second quarters of 2022 -- its first quarterly losses since 2015. Those headwinds have sent its share price tumbling, and the stock currently trades 38% off its high.

Here's why patient investors should view that as a buying opportunity.

Amazon operates the most popular online marketplace

Amazon has transitioned from an e-commerce pioneer to a retail powerhouse. In fact, Amazon is the second-largest retailer in the world, according to the National Retail Federation, and it operates the most popular online marketplace on the planet, receiving nearly twice as many monthly visits as the next closest competitor.

In 2022, eMarketer estimates Amazon will account for nearly 40% of online retail sales in the U.S., more than the next 14 companies combined. That success stems in part from its expansive logistics network. Amazon has invested in warehouses, planes, trucks, and electric vans, and those assets afford the company tight control over the shipping process. In turn, Amazon can provide fulfillment services to merchants, and it can delight buyers with fast and reliable deliveries.

Looking ahead, online retail sales worldwide are expected to increase at 10% annually to reach $7.4 trillion in 2025, while online retail sales in the U.S. are expected to grow faster than 12% annually to reach $1.5 trillion in 2025. That puts Amazon in front of a big addressable market, and the U.S. (its strongest geography) accounts for one-fifth of that opportunity.

AWS is the most innovative cloud computing company

Amazon Web Services (AWS) has evolved into a cloud computing colossus. It offers more services (and more features within those services) than any other vendor, and it currently holds a 34% share in the cloud infrastructure market, more than Microsoft Azure and Alphabet's Google Cloud combined.

Better yet, research company Gartner recently crowned AWS the cloud innovation leader, saying that "AWS has materially more mind share across a broad range of personas and customer types than all other providers." That advantage should keep AWS on the cutting edge of cloud computing, and that has monumental implications for Amazon.

Cloud computing spend is expected to grow at 15.7% per year to reach $1.5 trillion by 2030, according to Grand View Research. That leaves a lot of room for AWS to grow. More importantly, AWS achieved an operating margin of 31.1% over the past year, but Amazon rarely tops an operating margin of 5% in its retail segments. That means Amazon should become more profitable as AWS accounts for a bigger portion of total revenue.

Amazon is one of the fastest-growing advertising businesses

Amazon is a rising star in the ad tech industry. The company nearly led the world in total ad revenue growth last year, at 61.4%, according to eMarketer, and it currently ranks as the fourth-largest digital ad business on the planet. That bodes well for its bottom line.

Worldwide digital ad spend will reach $876 billion by 2026, which implies 10% growth annually over the next four years. But Amazon is poised to grow even faster. Not only does it operate the most popular online marketplace, but it also owns the second most popular streaming platform (Amazon Fire TV) in the world, behind Roku. As online shopping and streaming media continue to win consumer mindshare, brands and marketers should continue to throw more money at Amazon.

Better yet, digital advertising (like cloud computing) is a higher-margin business than retail. Amazon does not provide specific details regarding its ad business, at least not yet, but using financial metrics from Google as a guide, an operating margin of 30% seems like a reasonable assumption. That means Amazon should become more profitable as advertising represents a larger portion of its top line.

With that in mind, shares currently trade at 2.4 times sales, an absolute bargain compared to the three-year average of 3.8 times sales. And given Amazon's strong position in e-commerce, cloud computing, and digital advertising -- three markets expected to notch double-digit growth in the coming years -- this stock is worth buying today.