Apple and Microsoft were bitter enemies for many years, so it's attracted some attention that Microsoft founder Bill Gates recently bought 501,044 shares in Apple stock.

The purchase was made by the Bill and Melinda Gates Foundation a few months ago and it seems to have been brilliantly timed. According to the Smarter Analyst site, Apple's share has risen by just over 25 percent since then, having dipped earlier in the year.

Older readers will remember Microsoft buying $150m of Apple shares in August 1997, a purchase that may have saved the Cupertino company from bankruptcy. Microsoft subsequently sold the shares in 2003 for a profit, but some feel the company should have held on a little longer, given that the iPhone launched in 2007 and Apple's stock went on to become the highest rated in the world.

The Gates Foundation has also recently bought shares in Amazon and Twitter and sold shares in Berkshire Hathaway. In total, the foundation sits on assets with a value of $46.8 billion, or around £38 billion.

You may not be able to make as huge a profit as the Gates Foundation, but if you're interested in dabbling in the stock market, read How to buy Apple Shares.

This article originally appeared on MacWorld Sweden. Translation by David Price.