Image source: IBM.

International Business Machines (IBM 0.17%) has been a prolific buyer of its own shares. The company has reduced its outstanding share count by about 37% over the past decade, and in the past five years alone, Big Blue has poured $59 billion into share buybacks. The stock has risen about 80% over the past 10 years, but it's down considerably from highs reached in 2013.

IBM Chart

IBM data by YCharts.

IBM's heavy buyback activity in the past five years hasn't helped the stock, but that doesn't necessarily mean the company made a mistake. The short-term performance of a stock should not act as a litmus test for whether a past buyback was reasonable. Instead, investors should ask whether the buyback made sense at the time.

Billions down the drain?

IBM spent over $10 billion on share buybacks annually from 2011 through 2014, a staggering sum, to be sure. The slump in the stock price over the past few years would suggest that this money was wasted. But the purpose of share buybacks shouldn't be to boost the stock price, despite many companies buying their own shares for exactly that reason. The purpose is to deploy capital in a way that generates the best possible rate of return.

IBM generates a tremendous amount of free cash flow, so much that it can't possibly invest it all back into the business at a reasonable rate of return. In 2011, for example, the company reported about $15.2 billion of free cash flow. That was after spending $4.1 billion on capital expenditures and $6.3 billion on research and development. Even backing out the $1.8 billion IBM spent on acquisitions that year, the company still generated around $13.4 billion in excess free cash flow.

Now, one could argue that the company should have ramped up R&D spending, or that more acquisitions should have been made to drive growth. But IBM has generally been able to avoid making genuinely bad acquisitions in recent years. Think Microsoft's acquisition of Nokia's phone operations, which led to a $7.6 billion writedown. Or Hewlett-Packard's acquisition of Autonomy, which led to an $8.8 billion writedown. IBM usually opts for smaller acquisitions with the goal of building out its product offerings, instead of transformational acquisitions that often end with a big write-off.

Having billions of dollars left over each year isn't enough to ensure that using that cash for buybacks makes sense. The price of the stock has to be reasonable -- otherwise, the rate of return would be poor. Graphics chip company NVIDIA (NVDA 2.01%) offers a good example of a share buyback program gone wrong. NVIDIA's stock has soared in recent years, pushing its valuation to inflated levels, but the company continues to pour money into its own shares. I estimated in a recent article that NVIDIA's $500 million share buyback program would generate an equivalent pre-tax return on investment of less than 4%. NVIDIA's buybacks are almost certainly going to destroy shareholder value, not create it.

Even when IBM's stock was hitting new highs in 2013, the company never paid an unreasonable price for its own shares. The highest P/E ratio IBM stock managed at the time was around 16.5, certainly not an obvious bargain, but also not obviously overpriced. NVIDIA, in contrast, currently trades for nearly 40 times last year's earnings.

IBM PE Ratio (Annual) Chart

IBM P/E Ratio (Annual) data by YCharts.

IBM's per-share operating income was 31% higher in 2015 than it would have been if the company's share count had remained flat since the start of 2011. If the $59 billion that was spent on buybacks during that time was instead invested back into the company, IBM would have needed to generate an 8.2% pre-tax return on investment in order to match the boost provided by buybacks. Since there's no way IBM could possibly invest that much excess cash and get a reasonable rate of return, buybacks were an attractive option.

Buybacks should continue

The best time for a company to buy its own shares is when the stock is depressed. IBM has suffered from falling revenue and profits over the past few years, and the stock now trades for just 11 times expected 2016 earnings of $13.50 per share. However, a significant component driving this decline has been currency. In 2015, while IBM reported a 12% decline in revenue, sales slumped by just 1% adjusting for currency and divestitures. IBM estimated during its fourth-quarter conference call that 2016 pre-tax profits would be reduced by $1.3 billion because of currency issues alone.

Another factor is IBM's ongoing transformation. Growth businesses like analytics and cloud computing aren't quite offsetting declines in legacy businesses, and that's putting additional pressure on the company's profits. IBM's strategy of focusing on high-value areas where the company can carve out a competitive advantage makes sense, and while the success of the transformation is far from guaranteed, I like the company's chances.

The tens of billions of dollars IBM has spent on share buybacks over the years have not been wasted, despite the recent decline in the stock price. IBM paid reasonable prices for its shares over the past five years, and with the stock price currently at depressed levels, the company should continue to buy back shares going forward.