Warren Buffett's Berkshire Hathaway (BRK.B -0.69%) revealed an 11% stake in HP (HPQ 1.59%), sending the stock up nearly 15% on April 7. Many investors like to track Buffett's moves to follow along with one of the greatest investors of all time. However, I think Buffett could have spent his $4.2 billion better elsewhere.

HP benefited from a one-time pandemic boost in personal computers and printers when many people were forced to work from home. As a result, the company will likely revert to previous growth patterns, which weren't impressive. In its 2019 fiscal year -- ending Oct. 31, 2019 -- its generally accepted accounting principles (GAAP) revenue growth was flat, and its non-GAAP earnings per share (EPS) rose 11% year over year. For FY 2021, revenue increased by 12%, and non-GAAP EPS was up 66%. With the company likely reverting to 2019-like financial results, there isn't a lot of upside left for HP.

Image source: HP.

People using HP products at a business meeting. Image source: HP.

So what did Warren Buffett see in HP? For one, it's an extremely cheap stock. HP trades for a mere seven times earnings, indicating the market believes earnings will fall or become stagnant. Buffett's value investing style sees potential to make money in a stock trading below his calculated intrinsic value. If it rises to his calculated value, then his investment will make a positive return.

However, I think he could have done much better by investing in Alphabet (GOOG 0.72%) (GOOGL 0.58%). While it trades at a higher valuation than HP, over the long term -- Buffett's preferred holding period -- it will likely be a better investment.

HPQ PE Ratio Chart

HPQ PE Ratio data by YCharts

Alphabet has higher-quality revenue streams

Using 2019's data, Alphabet grew revenue by 18% and EPS by 12%. Since then, Alphabet has become more efficient, with its profit margin rising nearly 50%, meaning it generates more from each dollar it brings in. While HP also saw a profit margin increase, this is primarily due to charging full price for its products rather than enticing potential customers with sale prices. As a result, HP will likely see some margin pressures in 2022, while Alphabet will be able to maintain its margins.

In 2021, Alphabet grew sales by 41% and EPS by 91%. These metrics were significantly better than HP's numbers, and unlike HP, Alphabet shows no signs of its pandemic boost subsiding.

With HP's computer and printer business, its customers purchase new products only when it's time to upgrade or something breaks. Alphabet derives much of its revenue from advertisements on YouTube and the Google search engine. It also owns the Android operating system and operates Google Cloud infrastructure. Its revenue streams are recurring, as businesses constantly spend on ads or pay monthly fees to use the cloud infrastructure. These are recession-proof revenue streams, unlike HP's, which are primarily discretionary. Should a recession strike the U.S., Alphabet will fare much better than HP.

Returning capital to shareholders

Both companies engage in share buybacks, but only HP pays a dividend. While Berkshire doesn't pay a dividend, Buffett loves it when the companies he owns do, as many of the stocks in Berkshire's portfolio pay one.

In its first quarter of 2022 (ending Jan. 31, 2022), HP repurchased $1.5 billion in stock and paid $271 million in dividends. This rate is unsustainable, as HP brought in only $1.1 billion in net earnings. So while the dividend likely won't be cut, HP will have to slow down its share repurchase plan eventually.

During Alphabet's Q4 2021, it bought back $13.5 billion in stock on net earnings of $20.6 billion. Unlike HP's, this rate is sustainable, and Alphabet could continue doing this indefinitely.

Using a shareholder payout rate (dividends plus buybacks divided by net income) of 65% (what Alphabet's was), Alphabet and HP could return 4.7% and 16% of their current market cap to shareholders annually. This return assumes both companies can maintain their earnings, something I have confidence Alphabet can do. For HP, I don't have as much confidence. However, if HP can sustainably reward shareholders with 16% of its market cap annually, I would give HP the edge over Alphabet.

The balance sheets

HP is in a much more precarious financial situation than Alphabet. As of Jan. 31, 2022, it has $3.4 billion in cash and $6.4 billion in debt for a net cash position of negative $2 billion. Alphabet's balance sheet is cleaner, with $140 billion in cash and marketable securities and long-term debt of $15 billion. With a much more secure financial position, Alphabet has more options with how it wants to run its business. The company has more cash left over for making acquisitions, developing new products, investing in promising upstarts, and other growth-promoting ideas.  With HP's dividend and debt commitments, it has much less economic freedom.

With a higher-quality revenue stream and a rock-solid balance sheet, Alphabet gets my investment instead of HP.

Picture of Warren Buffett

Master investor Warren Buffett. Image source: The Motley Fool.

At the end of the day, it's famed investor Warren Buffett's opinion versus mine. This kind of disagreement is what makes the stock market work. Every stock has buyers and sellers, all thinking they are right. I believe Alphabet's long-term growth prospects are much better than HP's and will invest accordingly.