While Goldman Sachs (NYSE:GS) could probably figure out ways to turn lima beans into hundred-dollar bills, the company "lost $6 billion trading, of all things, its own stock," according to a recent BusinessWeek article.

How'd Goldman do that? By buying back its own shares during the boom years, then selling them after the economy tanked and it needed capital. It bought high, sold low, and lost a ton of money.

Intrigued, I decided to see how other banks fared on this front:

Bank

Share Buybacks, 2004-2007

Goldman Sachs

$21.6 billion

Bank of America (NYSE:BAC)

$19.4 billion

Citigroup (NYSE:C)

$16.1 billion

JPMorgan Chase (NYSE:JPM)

$11.6 billion

American Express (NYSE:AXP)

$8.9 billion

Wells Fargo (NYSE:WFC)

$8.5 billion

Morgan Stanley (NYSE:MS)

$7.1 billion

Source: Capital IQ, a division of Standard & Poor's.

Cumulatively, that's $93 billion. These seven banks took in a total of about $163 billion in TARP funds since last fall. A lot of that has been repaid, but … you get the point.

Most of these banks also turned around and issued gobs of common equity, at prices that were a pittance of what they bought shares back for during the boom years.

Bank of America, for example, bought back $19.4 billion worth of stock when its shares traded between about $40 and $55, then sold more than $13 billion at around $11 a share. Heckuva job! Citigroup happily repurchased $16.1 billion of its own shares during the bubble, then sold about one-third of itself to taxpayers when it was nearing penny-stock territory. Well done, guys!

Some investors claim the current market mustn't be cheap, because companies haven't been quick to gobble up their own shares. That may be true. But if the last several years are any indication, it may be the ultimate contrarian indicator, too.

For related Foolishness:

Fool contributor Morgan Housel doesn't own shares in any of the companies mentioned in this article. American Express is a Motley Fool Inside Value recommendation. The Fool has a disclosure policy.