Many investors keep tabs on the stocks Warren Buffett owns through Berkshire Hathaway, hoping to emulate his success. There is nothing wrong with that. Great investors can be a source of great inspiration. However, the most important lessons an investor can learn from Buffett are philosophical in nature -- not necessarily which stocks to buy, but how to invest in stocks.

Buffett has 80 years of investing experience under his belt, and he has seen more than a few bear markets during his time. But all of those downturns inevitably ended in a new bull market, and there is no reason to believe the current situation is any different. To that end, Buffett once said market downturns are "an opportunity to increase our ownership of great companies with great management at good prices."

Amazon (AMZN -0.17%) accounts for less than 1% of Berkshire's portfolio, but it undoubtedly qualifies as a great company, and the stock looks too cheap to pass up. Here's what you should know.

The short-term trouble

Supply chain problems and rising costs have plagued the retail industry lately, and Amazon has suffered alongside its rivals. The company incurred $10 billion in incremental expenses in the first half of the year, driven by inflationary pressures and excess fulfillment capacity (due to overambitious planning). In addition, consumers have also spent less time shopping online as the social impacts of the pandemic have faded, further exacerbating the cost pressures.

Not surprisingly, Amazon delivered an underwhelming financial performance over the past year. Revenue climbed only 10% to $486 billion and cash from operations plunged 40% to $36 billion. Even worse, the company will almost certainly continue to struggle while inflation remains elevated, though management does expect to "grow into" excess fulfillment capacity in the second half of the year.

As a result, some investors have decided to part ways with the stock, which now trades 26% off its all-time high. But the selling has gone too far. Shares look downright cheap at their current valuation of 2.9 times sales -- a bargain compared to the three-year average of 3.8 times sales -- and some investors seem to have lost sight of the big picture. Amazon has a strong presence in e-commerce, cloud computing, and digital advertising, and all three markets are expected to grow quickly in the coming years.

The long-term potential

Amazon currently holds 38% market share in U.S. e-commerce, and it ranks as the world's most-visited online marketplace by a wide margin. Moreover, the Amazon brand is synonymous with convenience, and that should keep the company on top of the industry for the foreseeable future. On that note, retail e-commerce sales will grow at 10.6% per year to reach $7.4 trillion by 2025, according to eMarketer, leaving Amazon with plenty of room to grow.

Turning to cloud computing, Amazon Web Services (AWS) captured 34% of cloud infrastructure spend in the second quarter, which is more than Microsoft Azure and Alphabet's Google Cloud combined. AWS has consistently set the pace for innovation in the industry, and it offers far more services (and more features within those services) than any other cloud vendor. That should keep the company at the forefront of cloud computing for years to come, and that's important for two reasons.

First, cloud computing spend is expected to grow at 16% per year to reach $1.6 trillion by 2030, according to Grand View Research, putting Amazon in front of another massive opportunity. Second, AWS consistently achieves an operating margin of around 30%, making it much more profitable than the rest of Amazon's business. Put another way, as AWS accounts for a larger percentage of total revenue, Amazon should become increasingly profitable.

Finally, Amazon has quietly become a powerhouse in the digital ad industry, growing its market share from 2% in 2016 to 6% in 2021. That figure is expected to surpass 7% by 2030, according to eMarketer, as Amazon continues to gain ground on Google and Meta Platforms. While the company doesn't provide details (yet), digital advertising typically comes with much higher margins than retail. In other words, like cloud computing, as digital ad sales represent a greater portion of total revenue, Amazon should become increasingly profitable.

That's why this Warren Buffett stock is a screaming buy.