Even Warren Buffett isn't immune to bear markets. Last year, some of the billionaire investor's most exciting picks delivered dismal returns. One of those players was e-commerce and cloud-computing giant, Amazon (AMZN 1.30%). The stock sank 49%, underperforming the S&P 500 index.

But here's the good news: Difficult market times and declines in top stocks like Amazon won't last forever. In fact, a bull market is on the way. How can I be so sure? History shows that bull markets always follow bear markets. And in one of those optimistic, rising markets, growth stocks -- such as Amazon -- could thrive. Let's take a closer look at why.

Why this Buffett stock fell

First, let's check out why this Buffett stock sank in the first place. Higher inflation has hurt Amazon in two ways: It's driven Amazon's costs higher on everything from running warehouses to delivering packages; and it's weighed on consumers' buying power. That means they have less to spend -- even on essentials.

This is a general problem, affecting all retailers. But Amazon has encountered some specific headwinds too. The company's investment in stock of the electric vehicle maker Rivian Automotive resulted in a pre-tax valuation loss of $12.7 billion last year. That's after shares of Rivian sank 82% in 2022. Though this isn't great news, it is a temporary weight on earnings.

Amazon also has struggled with its massive investment in its fulfillment network. Following enormous demand during the earlier stages of the pandemic, the company decided to double its network, a project it completed in two years. The problem is, Amazon found itself with too much capacity. And that, too, increased the company's costs.

As a result of these factors, for 2022, Amazon announced its first annual loss in nearly a decade. And last year, the company reported quarter after quarter of declines in operating income and operating cash flow.

This may sound dismal. But if we take a long-term view, the picture looks a lot different. Amazon's problems today are temporary, and the company is taking the necessary steps to address them. To ease the impact of rising inflation, Amazon has been aggressively cutting costs across the business. This includes eliminating more than 18,000 jobs.

Productivity efforts

Job cuts and other measures are helping Amazon increase productivity across its fulfillment network. In the third quarter, Amazon's productivity efforts helped drive $1 billion in operations costs improvements.

But Amazon isn't cutting spending everywhere. The company still is investing in areas most likely to deliver gains over time. Last year, it increased spending in technology infrastructure by $10 billion. This should support the expansion of Amazon Web Services (AWS), Amazon's cloud-computing business. The move is important because AWS has driven Amazon's profit over the years. In 2021, it represented more than 70% of the company's total operating income.

Today, AWS clients are spending less, as rising costs are weighing on them too. But they're still sticking with AWS thanks to its variety of data-storage prices. And Amazon says its pipeline of AWS customers remains strong. In Q4, AWS still managed to deliver 20% sales growth even in a difficult environment.

Soaring in a bull market?

Now, let's get back to the idea of Amazon shares soaring in a bull market. As the general economic environment improves, some of the recent headwinds -- such as rising inflation -- should ease. And that's likely to help Amazon's earnings. That's because customers' spending power will improve, and Amazon's own costs should drop.

This represents a huge catalyst for Amazon, especially considering the extent of Amazon's decline. The stock today trades near its lowest in relation to sales since 2016.

AMZN PS Ratio Chart

AMZN PS Ratio data by YCharts.

Now, you might be wondering when this bull market will arrive. History shows us bear markets generally last about a year. Of course, each bear market is unique, so no one can guarantee today's down market will follow the timing of those of the past.

Still, we can be sure better days are on the way. And Amazon's leadership in two high-growth markets -- e-commerce and cloud computing -- and its efforts to manage headwinds today could help this Buffett stock surge when the market takes off.