In a way, Microsoft (Nasdaq: MSFT) and IBM (NYSE: IBM) couldn't be more different. Microsoft has lost a third of its value over the past decade; IBM has gained 50%. IBM recently surpassed Microsoft in market capitalization for the first time since 1996.

In other ways, they're a lot alike. Microsoft has grown earnings per share by 10.9% annually for the past decade. IBM's growth over the same period? 10.2%. Analyst estimates for Microsoft's five-year projected growth rate is 10.3% -- IBM's, 11.2%.                   

These are different companies with different products in different industries, yet both past and projected growth are about equal. Shareholder returns, however, couldn't be more night and day.

Why?

I think you can break this conundrum down into two parts. Both are huge lessons every investor should be aware of.

1) The most important lesson in investing 
The most important lesson in investing is simple: Starting price determines future returns.

A parade of analysts and investors chide Microsoft for its abysmal shareholder returns over the past decade. In reality, Microsoft the company has done terrific. How many large companies grew earnings at 10% annually during one the worst economic decades on record? (11, if you're wondering). Nearly all of the misery Microsoft investors experienced over the past 10 years can be explained by starting valuation. Shares traded at 60 times earnings at the start of the last decade. Shareholders' fate was already sealed at that point. There was no realistic outcome that could have left them with anything other than tears today.

IBM was a different story. While it, too, was caught up in the dot-com bubble, it never got outrageously out of whack. Ten years ago, IBM shares traded at roughly 25 times earnings. That created a high hurdle but not an insurmountable one. The compression in IBM's earnings multiple over the past 10 years hasn't been drastic, letting shareholders enjoy at least some of the company's earnings growth. Microsoft's earnings multiple compression has been astronomical, causing shares to crumble even while the company grew briskly. The same story of flatlining returns amid strong earnings growth has happened to Wal-Mart (NYSE: WMT), Google (Nasdaq: GOOG), and Johnson & Johnson (NYSE: JNJ). Each case can be explained simply: Starting valuation determines future returns.

2) It's now just how much cash you earn. It's what you do with that cash. 
"IBM has an absolutely unequal record in capital allocation" said value investor Bill Miller last year. Microsoft's record is decent, but it's easily below IBM's.

One more statistic to toss in front of you: Cash as a percentage of IBM's market cap is about 6%. Microsoft's is a staggering 25%.                               

Both Microsoft and IBM churn out tons of cash. Both give lots back to shareholders with dividends and buybacks. But IBM takes the cake by keeping its balance sheet well-padded yet fairly lean. On the contrary, with some $50 billion lying around, Microsoft can nearly be described as a bank account with a software division attached to it.

You don't have to look far to see why investors punish a company for hoarding so much cash. Take Microsoft's recent $8.5 billion purchase of Skype, a deal done at a valuation universally panned as outrageous, irrational, and a sign of desperation. Deals like this combined with Microsoft's enormous and ever-growing pile of cash give investors an excuse to discount both the current cash hoard and future earnings. It creates uncertainty. What will the company do? More acquisitions? Raise the dividend? Repurchase shares? Many potential investors' reaction is let's wait and see, lest the company do something stupid -- like overpay for Skype. This is something IBM investors needn't spend much time worrying over. The company doesn't keep enough readily available tinder on its balance sheet to be quickly lured into something senseless. Unless a company has an impeccable record capital allocation -- such as Berkshire Hathaway (NYSE: BRK-B) -- investors discount large cash balances below par, keeping shareholder returns below what they could be. I've suggested Microsoft could end this problem by dramatically raising its dividend.

How much a company earns is just half the battle. What it does with that money is what seals shareholder returns.