© Reuters. A sign marks a Walgreens pharmacy in Somerville

By Siddharth Cavale and Diane Bartz

(Reuters) - Drugstore chain Walgreens Boots Alliance Inc (O: ) scrapped its deal to buy Rite Aid Corp (N: ) after failing to win antitrust approval, but said it would instead buy nearly half of the smaller rival's U.S. stores for $5.18 billion.

Rite Aid's shares plunged about 28 percent to $2.85, while Walgreens shares were up 1 percent at $77.97. Walgreens also ended a related deal to sell as many as 1,200 Rite Aid stores to Fred's Inc (O: ), sending Fred's shares down 19 percent.

Walgreens, the biggest U.S. drugstore chain, will likely have an easier time winning antitrust approval to buy 2,186 Rite Aid stores after it failed to win approval to take over the nearly 4,600-store chain.

"Walgreens and Rite Aid have taken a pragmatic approach," said Neil Saunders, managing director of market research firm GlobalData Retail.

The revised deal could offer many of the same benefits as a whole-sale take out of the company, but on a smaller scale.

Walgreens said it expects about $400 million of cost savings from its new agreement, down from around $1 billion expected from the original deal.

That could help offset challenges it faced in recent years hitting targets for sales growth, which has been weighed on in part by disappointing growth in its retail segment.

Walgreens also invited Rite Aid to join its group purchasing agreement, which aims to leverage the combined heft of its members to negotiate discounts on generic drug prices.

The decision to sell so many stores will weaken Rite Aid and could still be controversial, said David Balto, an antitrust lawyer who had worked with groups opposing Walgreens’ takeover of Rite Aid.

"Rite Aid's future is going to be bleak after they sell these stores. This is still going to raise some serious questions. It's still taking out a major competitor," Balto said.

In fact, Walgreens' plan to buy 2,186 Rite Aid stores accomplishes many of the same goals as the merger - including eliminating Rite Aid as a rival - but does so in a way that makes it harder for the FTC to take the companies to court to stop the transaction, antitrust experts said.

"Obviously no victory dance for the FTC today. This was a big stick-it-to-you. They're (the FTC) getting a worse outcome than they would before," said Andre Barlow of the law firm Doyle, Barlow and Mazard PLLC. "Clearly they (the companies) know what the FTC concerns are. They have likely worked around those issues, which has to be very frustrating for the FTC."

The FTC sued to stop two separate deals last week, suggesting that former administration's tough antitrust approach will continue under President Donald Trump. The agency is being run by Acting Chairwoman Maureen Ohlhausen and three commissioner slots are vacant.

The FTC said on Thursday it would review the new proposal.

WALGREENS TO PAY MORE PER STORE

Rite Aid said the stores to be sold are mainly in the Northeast, Mid-Atlantic and Southeast. The deal also includes distribution centers in Connecticut, Pennsylvania and South Carolina.

Leerink Partners analyst David Larsen estimated that under the new deal, Walgreens would be paying $2.4 million per Rite Aid store, higher than what it would have paid under a previous agreement, where it would have paid $2.04 million to $2.06 million per store.

Walgreens said on Thursday it expects the new deal to close within six months.

Walgreens also reported better-than-expected profit and sales for the third quarter, helped by a rise in prescription volumes in its U.S. pharmacy business.

The company also authorized a $5 billion buyback program and raised the lower end of its full-year profit forecast by 8 cents per share to a range of $4.98 to $5.08.

Analysts on average were expecting full-year profit of $4.96 per share, according to Thomson Reuters I/B/E/S.

The new agreement will assist Rite Aid in addressing pharmacy margin challenges and in significantly reducing debt, the company's CEO John Standley said in a statement.

Walgreens said it would pay Rite Aid a $325 million termination fee. In October 2015, Walgreens said it would buy No. 3 Rite Aid for $9.5 billion.