What happened

Shares of Rite Aid Corporation (RAD 5.26%) and Fred's Inc. (FRED) both plunged today after Walgreens Boots Alliance's (WBA -0.23%) proposed merger with Rite Aid fell through.

As of 11:40 a.m. EDT, Rite Aid stock was down 24.9%, Fred's was off 17.9%, and Walgreens was down 0.6% after climbing as much as 5.8% earlier in the session.

A pharmacist hands medicine to a customer.

Image source: Getty Images.

So what

Walgreens said that instead of merging with Rite Aid, as it had initially proposed in October 2015, it would acquire 2,186 stores, about half of Rite Aid's total locations, along with three distribution centers from the nation's No. 3 drugstore chain, for $5.175 billion.

Walgreens feared that regulators would block the original deal, which had an approval deadline set for July 7, as it would leave just two major pharmacy chains in the country -- Walgreens and CVS Health (NYSE: CVS) -- and make Walgreens the new biggest chain.

The newest deal replaced an amended proposal late last year in which Walgreens, the No. 2 drugstore chain in the U.S., was to merge with Rite Aid and sell off a number of locations to Fred's Inc. Fred's, a discount chain in the southeast U.S. whose stock popped in December when it was set to take over 865 Rite Aid stores, is left out of the new deal between Walgreens and Rite Aid. That caused its shares to plummet today.

Rite Aid investors, meanwhile, had been counting on a merger with Walgreens to save the debt-ridden chain as Walgreens' payment for the 2,186 stores, mainly on the Eastern seaboard, exceeds Rite Aid's market cap after today's slide by $2 billion. Rite Aid currently has $7.3 billion in debt on its balance sheet, and reported free cash flow close to negative $200 million last year. An annual interest expense of nearly $500 million has erased much of its operating profits in recent years.

While the deal to sell nearly half of its store fleet is not what investors had hoped for before, it's better than the Federal Trade Commission's breaking it up and Rite Aid being left with nothing, as Walgreens had feared. Rite Aid will also receive a $325 million termination fee from the end of the merger. 

Rite Aid CEO John Standley said in a statement, "While we believe that pursuing the merger with WBA was the right thing to do for our investors and customers, this new agreement provides a clear path forward and positions Rite Aid as a strong, independent, multi-regional drugstore chain and pharmacy benefits manager with a compelling footprint in key markets." He went on to say that a "substantial majority" of the cash influx would be used to pay off debt, reducing the company's leverage. 

Walgreens CEO Stefano Pessina, meanwhile, said: "This new transaction extends our growth strategy and offers additional operational and financial benefits. It will allow us to expand and optimize our retail pharmacy network in key markets in the U.S., including the Northeast, and provide customers and patients with greater access to convenient, affordable care." He added that the deal addressed previous competitive concerns and that regulators had signaled their approval.

Now what

Walgreens expects the deal to be "modestly accretive" to EPS in the first full year after it closes, and management said it would cut costs through synergies over the next three to four years to save more than $400 million annually.

CVS shares were down 1.6% on the news, a sign that the market sees the increase in Walgreens' store base as a challenge to the current domestic leader. 

Both companies also reported earnings today with Rite Aid saying comparable sales fell 3.9%, which led to an adjusted loss of $0.07 a share. Walgreens saw a 3.7% increase in U.S. comparable sales, and adjusted earnings per share increased 13% to $1.33.

The Rite Aid deal seemed to weigh on Walgreens shares since its announcement, and I'd expect the stock to do better now that the company is free to pursue other acquisitions as it has done aggressively in recent years, most famously by merging with Boots Alliance. Rite Aid, on the other hand, should emerge stronger and more profitable as it can use the $5.5 billion cash injection to lower debt and interest payments and to remodel stores.

The deal is expected to close within the next six months.