Warren Buffett first bought shares of International Business Machines (IBM 0.17%) in 2011, building a position worth nearly $11 billion for Berkshire Hathaway (BRK.A 0.48%) (BRK.B 0.44%). The stock has performed poorly since then, leading many to question Buffett's rare foray into the world of technology stocks. IBM has suffered 16 consecutive quarters of year-over-year revenue declines, and the company expects its earnings to slump this year.

IBM Chart

IBM data by YCharts.

Despite IBM's poor performance, Buffett has continued to add to Berkshire's stake in IBM. While a $1 billion stake in Apple initiated by one of Buffett's investment managers got most of the attention when Berkshire filed its latest quarterly report, the company also disclosed a small increase in its IBM position. With IBM struggling, why exactly is Buffett still so confident in the company?

Why Buffett bought IBM

Image Source: IBM.

Buffett's original purchase of IBM came as quite a shock. The billionaire generally avoids buying technology stocks because future earnings are difficult to predict. In a 2011 interview on CNBC, Buffett pointed out that he didn't buy railroad companies for a long time, either. IBM's annual report that year changed his mind on the company.

What did Buffett see in IBM? He described his decision-making process in the same interview: "And then we went around to all of our companies to see how their IT departments functioned and why they made the decisions they made. And I just came away with a different view of the position that IBM holds within IT departments and why they hold it and the stickiness and a whole bunch of things."

The IT industry has changed over the past five years in a pretty dramatic way. Cloud computing has transitioned from a buzzword to a transformative force in the industry, and the rapid growth of Amazon's AWS and other cloud infrastructure providers has freed organizations from having no choice but to buy their own hardware.

IBM doesn't enjoy the same reverence as it once did. The catch phrase "Nobody ever got fired for buying IBM" is a thing of the past. But IBM's purpose, to solve its clients' problems and help them succeed, hasn't changed. And its stickiness in the IT industry hasn't changed either.

Roughly 80% of IBM's revenue comes from clients who use multiple IBM solutions. IBM's strategy has long been to provide integrated solutions, spanning hardware, software, and services, and this creates major switching costs for IBM's clients. This advantage would eventually disappear if IBM sat still, but the company has been evolving along with the industry, investing heavily in areas like cloud computing, analytics, and security.

As a result, the makeup of the services that IBM provides is changing. Less hardware, more cloud is probably a pretty apt description. What isn't changing is the need for those services. Transitioning to and then managing a cloud-based infrastructure is not a trivial task. IT isn't made any simpler by cloud computing.

The core thesis behind Buffett's investment in IBM -- the company's position and inertia in the IT industry -- remains largely intact. Buffett certainly believes that; otherwise he wouldn't be continuing to buy shares. Most of IBM's reported revenue declines over the past few years have been the result of currency exchange rates and divestitures of underperforming businesses. The company is still reporting lackluster results, but its performance is not nearly as bad as the headlines suggest.

Even after four years of weak results, IBM still expects to generate around $12 billion of free cash flow this year. That's below the $15.2 billion generated in 2011, but it's roughly the same as a percentage of revenue. Given the companywide transformation, with billions of dollars of spending being shifted to high-growth areas, IBM's ability to largely maintain its profitability is a testament to the strength of the company's business model.

Buffett's investment in IBM may look like a mistake on the surface, with the stock price down considerably over the past few years. But the reason why the billionaire bought the stock in the first place hasn't changed, and I think there's a very good chance that it works out well for Berkshire in the long run.