Economic headwinds sent the S&P 500 into a bear market last year, and the benchmark index is still 16% off its high. Warren Buffett's Berkshire Hathaway treated the drawdown as a buying opportunity, investing $66 billion into the stock market through the first three quarters of 2022. That's more money than Berkshire invested during the previous three years combined.

Why is the company being so aggressive? Smart investors like Buffett know that a bear market offers investors a chance to buy good stocks at great prices. With that in mind, here are two Buffett stocks to buy now and hold forever.

1. Amazon: Down 48% from its high

The first stock worth buying is Amazon (AMZN -1.64%). The retail giant struggled over the past year, as high inflation slowed consumer spending and increased operating expenses. That led to losses in the first and second quarters -- its first quarterly losses since 2015.

While Amazon managed to eke out a profit in the third quarter, earnings still fell 10% from the prior year. The stock is currently down 48% on those dismal results.

Admittedly, Amazon may continue to struggle in the near term, but the company is set to reaccelerate growth and return to profitability in the long run. Amazon accounts for about 40% of all online retail sales in the U.S. and operates the most visited e-commerce marketplace on the planet. That makes it a cornerstone of global e-commerce, a market expected to grow at 14% annually to reach $15 trillion by 2030. But Amazon has more profitable opportunities in cloud computing and digital advertising.

Amazon Web Services (AWS) holds an industry-leading 34% market share in cloud infrastructure and platform services (CIPS), more than Microsoft Azure and Alphabet's Google Cloud Platform put together. IT research company Gartner named AWS the CIPS leader for the past 12 years. That bodes well for the future.

Cloud computing spend is expected to grow 16% annually to reach $1.6 trillion by 2030. Better yet, AWS reported an operating margin of 30% over the trailing 12 months, making it far more profitable than its retail segment, which typically reports an operating margin in the low- to mid-single digits.

Additionally, Amazon piggybacked off the popularity of its marketplace to build the fourth-largest digital-advertising business in the world, and it's gaining market share as the industry leader Google loses ground. That puts Amazon in a good spot.

Global digital ad spend is expected to grow by 9% annually to reach $1.3 trillion by 2030. Amazon doesn't provide profitability metrics related to its ad business, but Google's services segment, which primarily generates revenue through digital advertising, reported an operating margin of 32% in the most recent quarter. Investors can assume Amazon is in the same ballpark.

Putting the pieces together, Amazon is well-positioned to deliver solid top-line growth through the end of the decade and should become more profitable as cloud computing and digital advertising account for a greater portion of total revenue. With that in mind, shares of Amazon currently trade at 2 times sales, a discount to the three-year average of 3.6 times sales. That's why this growth stock is a buy.

2. PayPal: Down 74% from its high

The second Buffett stock worth buying is PayPal Holdings (PYPL 0.64%). To be clear, Berkshire doesn't have a direct stake in PayPal, but New England Asset Management (NEAM) owns shares, and NEAM is a subsidiary of Berkshire. To that end, my colleague Sean Williams often refers to NEAM as Buffett's secret portfolio.

PayPal stock is currently trading around 74% off its high. That downturn was fueled by a combination of poor financial results and weak guidance as the economic climate deteriorated. But management responded admirably. The company slashed operating costs by $900 million last year and plans to cut another $1.3 billion in 2023. That should boost its operating margin by at least 100 basis points this year.

Additionally, management plans to focus investments on growth opportunities where PayPal already has a strong competitive position. That includes the PayPal and Venmo digital wallets, PayPal Checkout, and Braintree, a more customizable checkout solution for large e-commerce businesses.

For context, PayPal currently leads the industry with 42% market share in online payment processing. It's the most accepted digital wallet in North America and Europe and was the second-most downloaded finance app worldwide in 2022, according to Apptopia.

That ironclad competitive position sets PayPal up to grow quickly in the coming years. The company reported total payment volume of $1.3 trillion over the trailing 12 months, a mere fraction of its $110 trillion market opportunity. And while PayPal is already the leader in online payment processing, its recent partnership with Apple could give it a better foothold in physical retail.

Specifically, U.S. consumers will soon be able to add their PayPal- and Venmo-branded payment cards to their Apple Wallets and use them anywhere Apple Pay is accepted. That's an exciting development because Apple Pay is the most popular in-store mobile wallet in the U.S. by a wide margin.

Currently, shares trade at 3.4 times sales, a discount to the three-year average of 9.1 times sales. That creates a very attractive buying opportunity for investors.