It's not a waste of money. They just bought out 28 million shareholders. It's only a waste of money if you consider for example paying back your mortgage or your credit card debt a waste of money.
Look at it at a smaller scale: Say four guys own a company worth a million dollar. Then some analyst says the company is only worth $900,000, and three of the guys pay $225,000 to the fourth to buy him out, because he thinks the analyst is right and they think the analyst is wrong. So now three guys own a company worth $775,000. They are each richer than before.
In terms of actual productive effort, $14 billion was spent shifting papers. That's it. It's paper profit, assuming their stock goes up and stays up. Apple of old didn't care about their stock. The market will do whatever the hell it pleases and Apple can't stop it. Placating a few stockholders and a lifetime douchebag pump-and-dumper is not a good use of money.
Apple is in a unique position where they don't have to buy their stock to make it go up. They can invent and sell the future and make it go up. They have the engineering effort and production capacity to make anything. Apple spent a small fraction of $14 billion to develop the first Mac, the first iPod, the first iPhone. All of these things provided infinitely more long-term value to the company and by extension, shareholders, than buying back some stock.