Investor Warren Buffett spent decades avoiding technology stocks, so he attracted a lot of attention when he bought shares in IBM. It was seen as a vote of confidence in the struggling company's strategy, which was reassuring to corporate IT buyers.

It turned out to be a bad move, financially, but it hasn't put him off technology companies. While he has drastically reduced his IBM holding, he has invested heavily in Apple.

Following the annual letter to shareholders, released on Saturday, Apple is now Berkshire Hathaway's biggest single investment, and makes up almost 15 percent of its holdings. It's bigger than Buffett's long-term investments in Wells Fargo, Kraft Heinz, Bank of America, Coca Cola and American Express.

Berkshire Hathaway now holds 165.3 million Apple shares worth $28 billion. The IBM holding has shrunk from 80 million shares to only 1.2 million, worth $314 million. This represents only 0.16 percent of the Berkshire Hathaway's holdings.

Buffett started buying IBM shares in 2011, when he picked up 64 million shares for $10.7bn. At the time he said: "I don't know of any large company that really has been as specific on what they intend to do and how they intend to do it as IBM,"

Way back then, IBM CEO Sam Palmisano planned to increase earnings per share by buying back shares and shifting sales from low to high-margin businesses. These were its "strategic imperatives". The target was $20 in earnings per share by 2015.

But in 2012, Ginni Rometty replaced Palmisano as CEO, and IBM's sales have declined every year since then. She abandoned the EPS target in October 2014 when it was clear IBM wouldn't make it.

Buffett - known for being a long-term investor - belatedly admitted his mistake in May 2017 when he told CNBC that IBM "hasn't done what, five or six years ago, I expected would happen - or what the management expected would happen."

He added: "But I was wrong. I don't blame them. I get paid to make my own decisions, and sometimes they're right and sometimes they're wrong." (See; $4 billion stock sale suggests Warren Buffett's love affair with IBM is over)

Buffett said he had already sold "in the area of 24-25 million" IBM shares. He was ready to sell more shares at a loss to get the tax benefits before the Republicans cut corporate taxes. Given IBM's dividend payments, he may have come out ahead, but he could have tripled his money over the market's long bull run.

By then, Buffett had already bought at least $1 billion-worth of Apple shares at around $108 per share. Well, not him personally, as I pointed out at the time. (See: No, Warren Buffett didn't buy Apple shares, or bid for Yahoo...) The purchase was made by one of Berkshire Hathaway's two investment managers, Todd Combs and Ted Weschler. They control around $9bn each.

This turned out to be a very good deal, because Apple's share price recently climbed to an all-time high of $180. Indeed, Buffett helped by praising the company on CNBC. On Monday of this week, he told CNBC's Squawk Box: "Apple has an extraordinary consumer franchise. I see how strong that ecosystem is, to an extraordinary degree. ... You are very, very, very locked in, at least psychologically and mentally, to the product you are using. [The iPhone] is a very sticky product."

(No, he doesn't actually use an iPhone. He uses a Samsung flip-phone.)

One of the attractive things about Apple is that it is planning to repatriate some $250bn in cash, which is currently parked outside of America. Apple said, during the conference call for its latest quarterly results: "we are targeting to become approximately net cash neutral over time."

In other words, Apple will either buy a big company like Netflix - which seems unlikely - or spend $160bn (net of debt) on its own shares, or give the cash to shareholders like Buffett.

If it gives the cash to shareholders, Buffett will collect around $5bn, though perhaps not all at once.

The repatriation could mark a change from Apple being seen as a "growth stock" - where shareholders expect to benefit from rapidly increasing sales pushing up the share price - to a "dividend stock" like IBM, where investors look for better annual returns than they would get from bonds, or whatever.

It's a sobering thought that Apple shares were $53.43 or less in December 2011 when IBM shares cost $192.42. Today, Apple has climbed to $178 while IBM has fallen to $158. If Buffet had bought $10.7bn of Apple shares instead of IBM shares, they'd be worth around $36bn.

But I wouldn't feel too sorry for Berkshire Hathaway, because it currently has $116bn in cash....

Financial disclosure: I don't personally own any shares in any company, nor do I plan to. I am totally unqualified to give financial advice, so I don't. Any predictions I may accidentally have made in the past have been staggeringly wrong. No sensible person would trust me with their lunch money.