Fredneck is right. You are neglecting the fact that any cash (and debt) must be included in the market cap. Spending money on a share buyback reduces the amount of cash, and therefore the market cap by an equivalent amount.
Imagine, for the sake of simplicity, a company holds $100 million in cash. The company has no debt and no operations - a cash-holding company, so to speak. Clearly, the company should be valued at exactly $100 million. The company has a million shares outstanding. Each share is worth $100.
Now the company decides to buy back half its shares, for $50 million. It now has $50 million in cash, it's market value is $50 million, and there are 500,000 shares outstanding. So each share is still worth $100, but the market cap is halved, as it should.
This is exactly the reverse of raising capital: The next year, the company might raise $950 million in capital by selling 9,500,000 shares at $100 each. Now the cash hoard is $1 billion, the company is worth $1 billion, but with 10 million shares outstanding, so the stock price is still $100/share.