Investors love share buybacks. As they should. Done properly, they can be a great way to deliver shareholder value.

Companies love buybacks, too. S&P 500 companies have spent $1.4 trillion on buybacks since the start of 2008, according to S&P.

But The Wall Street Journal recently wrote something curious (emphasis mine):

Aggregate shares outstanding amounted to 299.1 billion [in the third quarter], which is the lowest level since the fourth quarter of 2008. Since 2005, the index has actually averaged year-over-year quarterly dilution of 2.7%.

This took me aback. Despite spending more than a trillion dollars on share buybacks in the past four years, total shares outstanding actually increased since 2005. And that isn't due to share splits that would distort the numbers. Total shares outstanding really, truly rose.

I did some digging to find out more. Taking current S&P companies that were around at the start of 2007 (there are 474 of them), here's how the split-adjusted total shares outstanding count has changed over the past five years:

S&P Shares Outstanding, January 2007

S&P Shares Outstanding, September 2012

282 billion

292 billion

Sources: S&P Capital IQ, author's calculations.

During a period when companies spent more than $1 trillion on buybacks, shares outstanding rose by 10 billion.

What's going on here?

There are three explanations.

One is that while companies buy back a lot of shares, they also issue shares to make acquisitions. Take Bank of America (NYSE:BAC). It issued a lot of stock in 2008 to finance its purchase of Merrill Lynch. So even though the bank repurchased $3.8 billion of its own stock in 2007, shares outstanding increased.

There's nothing inherently wrong with issuing shares to buy a company. But for a company to repurchase stock and then issue new stock soon after to make an acquisition doesn't make a lot of sense. When management repurchases stock, it is effectively telling shareholders that its stock is so undervalued that the company won't find a better investment opportunity elsewhere if it instead paid a dividend. When management issues stock to purchase a company, it is effectively arguing that shares are valued so richly that it can afford to use them as a currency. It's hard to reconcile the two.

Companies also issued gobs of new shares during the financial crisis to raise capital. Bank of America, Citigroup (NYSE:C), Goldman Sachs (NYSE:GS), AIG (NYSE:AIG), and others had to issue new stock as the banking system crashed. Most did so at measly prices, more than offsetting any buybacks done in the previous decade. It was a perfect example of buy high, sell low.

Netflix (NASDAQ:NFLX) is one of the most egregious examples. In 2011 it spent $199 million buying back its stock for an average price of $222 a share, and then it sold shares back to the market a few months later for $70 each to raise cash. "Netflix effectively flushed $140 million of shareholder wealth down the drain in nine months flat," I wrote at the time. "That's the equivalent of losing 1.3 million subscribers for a year."

A third reason shares outstanding rose is that companies issue shares or options to management as compensation and use buybacks to sop up the new supply.

The Wall Street Journal recently used eBay (NASDAQ:EBAY) as an example:

On July 18, for example, eBay reported it had bought back $355 million of stock during the second quarter and would repurchase $2 billion additional shares. The primary objective, the company said, was to offset the additional shares being issued as compensation.

"If you're asking yourself, 'Wait, so buybacks can be used as a tool to transfer shareholder money to the executives?,'" blogger Josh Brown wrote last fall, "then you've got it figured out, that's exactly what they can be used for. And they often are."

There's nothing intently wrong with this, either -- just as long as shareholders know what's going on.

The textbooks say share buybacks create value by decreasing the number of shares outstanding. I'd add an asterisk to that statement: They decrease the number of shares outstanding, all else equal. Unfortunately, all else rarely is.