It wasn't strictly cash, it was an agreement to buy $150 million of stock as part of a Judge-approved settlement of a lawsuit which Apple was winning. The settlement was a win-win for both sides, because it meant Apple remained a healthy company and Microsoft got to avoid paying out BILLIONS to Apple. Instead they bought stock which they sold for a tidy profit ($550 million) a few years later.
(Fun fact: if Microsoft hadn't sold this $150 million investment in Apple stock, it would be worth $120 BILLION today and this shareholding would be Microsoft's single most profitable business unit.)