Bed Bath & Beyond, Inc. (BBBY) shares nosedived last week after the home-furnishings retailer posted disappointing earnings numbers.

Revenue fell 1.7% and comparable sales slipped 2.6%, while adjusted earnings per share dropped from $1.11 a year ago to $0.78.

Like other big-box retailers, Bed Bath & Beyond has been challenged by declining mall traffic as Americans increasingly look to e-commerce sites like Amazon.com or Wayfair for their shopping needs in the home-furnishings space.

A Bed, Bath & Beyond storefront

Image source: Bed, Bath & Beyond.

Bed Bath & Beyond stock is now down 48% over the last year and 65% over the last three years. But there's a more insidious reason for the stock's demise than simply competition and changing consumer dynamics.

Over the past five years, Bed Bath & Beyond has spent about $6 billion on share buybacks, yet the stock has lost about two-thirds of its value over that time. Today, its market cap is just $3.2 billion, meaning management has coughed up nearly double the company's current worth. If it had held onto that cash, the retailer would be much stronger today.

Share buybacks: The blessing and the curse

Companies like Bed Bath & Beyond repurchase shares for a number of reasons. Doing so artificially lifts earnings per share by lowering the number of shares outstanding, and investors generally greet share buyback announcements with enthusiasm. They're often used by profit-rich, slow-growth companies like Coca-Cola, Procter & Gamble, or Apple that have limited needs to invest cash in new businesses.

But Bed Bath & Beyond's folly illustrates how so many things can go wrong with share buybacks. Companies often buy back shares to signal that they believe their stock is undervalued, but as the chart below shows, Bed Bath & Beyond's buybacks peaked in 2014 when shares were at all-time highs:

BBBY Chart

BBBY data by YCharts.

Amazingly, the company spent more than $2 billion on share repurchases even as the coming threat to brick-and-mortar retailers became clear. Consulting firm Fortuna Advisors ranked the worst 25 performers in share buybacks from 2012 to 2016, and found that Bed, Bath & Beyond spent more than any other company on repurchases as a percentage of its market cap, at 104%.

With the stock now near recession-era lows, that strategy looks like a glaring mistake.

Not the only one

With retail stocks plumbing new lows even as the broader stock market is at all-time highs, Bed Bath & Beyond is far from the only brick-and-mortar retailer to fall for this trap. Radio Shack, for one, sealed its fate with excessive share buybacks in better days.

Other companies that have recently thrown money away on repurchases include Macy's (M -2.68%), Ralph Lauren (RL 0.72%), and Chipotle Mexican Grill (CMG -1.34%):

M Chart

M data by YCharts.

As the chart above shows, both Macy's and Ralph Lauren cut back on repurchases as their stock prices tumbled, since they were not enough to lift the struggling retailers. At Chipotle, meanwhile, share buybacks spiked last year as the stock fell following the company's E. coli scare, but shares have fallen further since then.

The bottom line is that share buybacks alone aren't enough to prop up struggling retailers, or companies like Chipotle in the midst of a brand crisis. Often, they only serve to squander money better used on improving the underlying business.

Mall-based retailers need to do the hard work of making stores attractive, and improving their e-commerce operations to remain competitive online. That requires real money to invest.

Spending on share buybacks is an easy decision, but too often it's the wrong one, and retailers seem to finally be waking up to that cold reality. Bed Bath & Beyond only spent $56 million on repurchases in the most recent quarter, but it may be too late.