The average hedge fund managers typically underperform the S&P 500, meaning their clients would actually be better off buying an S&P 500 index fund. That said, some fund managers buck the trend, and investors might want to look to them for inspiration.

For instance, Larry Robbins of Glenview Capital Management and Lewis Sanders of Sanders Capital have both outperformed the S&P 500 by a wide margin over the last three years, and both investors have been buying FAANG stocks throughout the bear market that started in 2022.

Since the beginning of last year, Robbins substantially increased his stake in Amazon (AMZN -1.65%), and it now accounts for more than 3% of his portfolio. Meanwhile, Sanders has aggressively added to his stake in Alphabet (GOOG -1.96%) (GOOGL -1.97%), and it now makes up more than 8% of his portfolio.

Is it time to buy these two FAANG stocks?

1. Amazon

Last year was devastating for Amazon shareholders. The stock price dropped 49% -- its worst performance since the dot-com crash in 2000 -- as the economy led to disappointing financial results.

The company posted a loss in the first and second quarters under generally accepted accounting principles (GAAP), and while it managed to return to profitability in the third quarter, operating income plunged 49% year over year to $2.5 billion. But investors need to look beyond the temporary economic headwinds.

Despite abysmal financial results, Amazon ranked as the second-most-valuable brand in the world in 2022 -- behind Apple -- according to Brand Finance, a distinction that reflects its strong competitive position in three growing markets.

Most consumers associate Amazon with e-commerce. The company operates the most-visited online marketplace in the world, and it accounts for nearly 40% of digital retail sales in the U.S. But Amazon has more-exciting growth opportunities in the higher-margin markets of cloud computing and digital advertising.

Research company Gartner has recognized Amazon Web Services (AWS) as a leader in cloud infrastructure and platform services (CIPS) for 12 consecutive years, and AWS captured 34% market share in CIPS in the third quarter, more than Microsoft Azure and Google Cloud combined.

That puts the company in a good position, with the cloud computing market expected to grow at nearly 16% annually to reach $1.6 trillion by 2030, according to consulting company Grand View Research. Better yet, AWS achieved an operating margin of 26% in the most recent quarter, while Amazon's retail business rarely cracks 5%. That means the parent company should become increasingly profitable as AWS accounts for a larger portion of its top line.

Amazon also ranks as the fourth-largest digital advertiser in the world, and it is gaining ground on the market leaders, Google and Meta Platforms. That trend bodes well for the company. Digital advertising also comes with much higher margins than retail, and global digital ad spend is expected to grow at 9% annually to reach $1.3 trillion by 2030, according to Precedence Research.

Currently, shares trade at 1.8 times sales, a bargain compared to the five-year average of 3.7. At that price, Amazon stock is a screaming buy.

2. Alphabet

Alphabet's Google ranked as the third-most-valuable brand in the world in 2022, according to Brand Finance, reflecting the immense popularity of its platforms like Google Search and YouTube. The former holds more than 92% market share among search engines, an achievement that underscores its expertise in artificial intelligence, and YouTube is the top streaming service as measured by viewing time.

Google paired that popularity (and the consumer data derived from those platforms) with a robust suite of ad tech solutions. Its portfolio includes buy-side tools that help brands deliver relevant advertising for consumers, as well as sell-side tools that help publishers monetize their ad inventory. Fueled by that expansive ecosystem, Google is the largest advertiser on the planet, capturing more than 28% of all digital ad dollars.

Google is also gaining ground in cloud computing, fueled by investments in product development and go-to-market capabilities. Google Cloud Platform captured 11% market share in CIPS in the third quarter of 2022, up from 7% two years earlier. As a caveat, Google still trails Amazon and Microsoft by a wide margin, but the company is firmly in third place and its product offering is improving more quickly than the market leaders, according to Gartner. 

Financially, Alphabet struggled amid the challenging economy because many brands cut their ad budgets to compensate for softening consumer demand. The company reported revenue growth of just 6% in the third quarter, and earnings dropped 24%. But those headwinds are temporary, and Alphabet still has a strong position in digital advertising and cloud computing.

Currently, shares trade at 4.2 times sales, a discount compared to the five-year average of 6.4. At that price, investors should consider buying a few shares of this FAANG stock.