Apple (AAPL 1.27%) is in its golden years, producing $8 billion per quarter in cash while it sits on a $146 billion cash hoard -- more cash than it has any idea what to do with. While activist investor Carl Icahn is pushing Apple to repurchase $150 billion of shares, Cupertino should instead learn from the mistakes of the previous decade's largest tech company, Hewlett-Packard (HPQ 1.55%). Read on, and I'll explain the problem with share buybacks, how HP screwed them up, and how Apple can do far better.

Source: Apple.

Theory versus practice
Despite what they teach in business school, stock buybacks are not always better than dividends. For one, they reward shareholders who are leaving, rather than those who are sticking with a company. Second, buybacks are only better if the stock the company is buying is undervalued.

Too often people forget the golden rule of investing: the price you pay matters. Unfortunately, most corporations buy stock like bad investors, purchasing high and selling low. A 2011 study from McKinsey found that S&P 500 companies tend to buy back more shares when their share prices are high and stop purchasing when prices are low. The study added that "from 2006 to 2010, share repurchases came at the expense of long-term loyal shareholders by delivering lower returns than they might otherwise have received."

A great example of this -- meaning a horrendous one for shareholders -- is Hewlett-Packard. While HP paid a token dividend, in boom times management pursued stock buybacks. As the stock fell, the company would lower the amount purchased, and as the stock rose, the company would increase its purchases. The effect was that its largest purchases in its history occurred when shares were about double their current price.

Source: S&P Capital IQ.

Between 2007 and July 201,1 HP bought back $46 billion in stock at an average price of roughly $44 per share. Shares trade for $27 now.

Besides reinvesting in the core business, buying back stock, or paying dividends, the other thing companies can do with their cash is make acquisitions. Large acquisitions have a long history of destroying shareholder returns, but managements tend to love them because they increase the size of the company they control. HP made two notable acquisitions in recent years: the company bought EDS for $13.9 billion in 2008, "furthering [HP's] standing as world's largest technology company," and Autonomy for $11 billion in 2011.

Source: S&P Capital IQ.

Most large acquisitions fail, but these were spectacular failures. They were written down in 2012 for $9 billion in losses each. HP stopped buying back stock as the stock dropped to $12 per share. HP has slowly begun to buy back some shares after the stock doubled from its low.

HP is a prime example of the overconfidence of corporate managers leading to billions of losses. Instead of buying back stock at inflated prices or empire-building through massive acquisitions, HP could have left its millions of shareholders far better off by pursuing a higher regular dividend policy. Dividends do a far better job of keeping management accountable, as they can't be silently cut back when the stock drops. This motivates management to make good decisions with a company's capital.

Apple
Apple is now in the position HP was in the 2000s. It's the largest tech company in the world, it's highly profitable, and it has more cash than it knows what to do with.

At the same time, analysts are calling for wasteful spending via expanding into new markets unrelated to its core business, such as building next-generation robotic factories, acquiring Tesla or Comcast or AT&T, cutting margins to gain market share, or even just returning cash to customers to "curry favor" with them.

Apple has responded slowly.

Source: S&P Capital IQ.

Apple started paying a dividend that is token in size relative to its cash pile. Now that prices have peaked, plummeted, and begun to rebound, Apple has also started to "return value to shareholders" through some buybacks at high prices. However, activists are pressing the company to initiate a $150 billion stock buyback.

The secret to Apple's success
The recipe to Apple's success has always been understanding customers' needs better than any other company, empowering small groups of people to do great work, obsessively pursuing perfection in design, and maintaining a singular focus that precludes all distractions. None of these require $150 billion, and the fact that CEO Tim Cook has spent so much time talking about it shows that the cash is a distraction.

The cash hoard should be a complete nonissue for Apple. Distribute excess cash to shareholders. Don't favor exiting shareholders over loyal long-term holders by buying back stock. Focus on what Apple does best -- making great products.

Two years ago, I said Apple could easily become a dividend powerhouse with a $10 billion-per-year dividend -- and this came true. Perhaps in 2014 Apple will take my suggestion and commit to a special dividend of $100 billion or more and maintain focus on making the great products we have come to love.