Hewlett-Packard (NYSE: HPQ) shareholders may have smiled to hear that the company has authorized a $10 billion stock buyback. The tech giant plans to spend at least $3 billion on shares this quarter. But investors shouldn't celebrate just yet; share buybacks aren't always a ticket to riches.

Stock boost
Investors like buybacks because they reduce the number of shares outstanding, making each remaining share represent a bigger piece of the company. That, in turn, typically boosts earnings per share. Buybacks also instill confidence, suggesting that management believes the stock is currently underpriced. That makes sense with Hewlett-Packard, which has seen its shares fall about 20% in the wake of former CEO Mark Hurd's resignation.

The Wall Street Journal recently noted that buyback announcements often trigger jumps in share prices. Over time, companies that engage in buybacks tend to outperform the market by some 3 percentage points annually -- nothing to sneeze at.

The bad side of buybacks
Buybacks aren't always the best idea, though. Remember that companies could do other things with that money: building more factories, hiring more workers, buying more advertising, etc. A buyback is a reward, but it doesn't hold the promise of more growth.

Research and development (R&D) is critical for companies in many industries. As BusinessWeek magazine noted in 2009, "[B]uybacks are rampant in industries where investment in innovation is crucial -- energy, technology, and pharmaceuticals."

BusinessWeek detailed buybacks by ExxonMobil (NYSE: XOM), Pfizer (NYSE: PFE), and Cisco Systems (Nasdaq: CSCO). The oil giant spent $144 billion buying back shares between 2000 and 2008, while Cisco also landed in the top 10 biggest buybacks over the period. It's particularly ironic that Pfizer, which argued that price regulation would hurt the pharmaceutical industry by taking away money from R&D, nevertheless diverted considerable funds away from R&D toward buybacks. According to the article, Amgen (Nasdaq: AMGN) spent more than its total net income between 2000 and 2008 on buybacks. 

Pricing matters
In addition, many companies have timed their buybacks poorly. Intel (Nasdaq: INTC), for example, spent $4.6 billion in 1999 buying shares at an average price of around $32. The price later fell near $12 several times, and it's still below $20. Citigroup (NYSE: C) bought back shares in 2006 and 2007 at an average of around $50 per share. Now, it trades for less than $5.

You want your bought-back shares to be attractively priced. That seems to be the case with Hewlett-Packard -- its recent P/E of around 11 is barely half its five-year average of 20, and its forward P/E is below 8, well below the S&P 500's 14.

Stock buybacks are a mixed bag. Hewlett-Packard's seems promising, especially since the company has a big cash pile and generates a lot more of those greenbacks annually. But in general, make sure the companies you like aren't wasting your money by paying too much to buy back their stock.

Buybacks may beat dividends on taxes, but hefty dividend payers are still darn compelling investments.

True to its name, The Motley Fool is made up of a motley assortment of writers and analysts, each with a unique perspective; sometimes we agree, sometimes we disagree, but we all believe in the power of learning from each other through our Foolish community.

Longtime Fool contributor Selena Maranjian owns shares of Amgen. Intel and Pfizer are Motley Fool Inside Value recommendations. The Fool has entered a bull call spread position on Cisco Systems. The Fool owns shares of and has written puts on Intel. Motley Fool Options has recommended buying calls on Intel. The Fool owns shares of Exxon Mobil. Try any of our investing newsletter services free for 30 days. The Motley Fool is Fools writing for Fools.