Walgreens Boots Alliance Inc. (WBA) and Rite Aid Corp. (RAD) on Thursday, June 29, nixed their $17.2 billion merger agreement and announced a new deal in which Walgreens will buy half of Rite Aid's stores for $5.175 billion.

The two drugstore chains' merger was originally announced Oct. 27, 2015. Walgreens agreed to pay $9 per Rite Aid shares, or about $9.5 billion, with an enterprise value of $17.2 billion including acquired net debt. On Jan. 30, Walgreens and Rite Aid reduced the offer price to $6.5 to $7 per share after the Federal Trade Commission said Walgreens' Dec. 20 offer to sell 865 Rite Aid stores to Fred's Inc. (FRED) was insufficient to obtain antitrust approval. Fred's will receive $25 million in merger expense reimbursement.

The new agreement came about due to feedback indicating that "the parties would not have obtained FTC clearance to consummate the merger," Rite Aid said in a statement. Walgreens had given the FTC until July 7 to file a lawsuit challenging the deal.

In addition to the cash consideration of the new deal, Walgreens will assume Rite Aid's related real estate leases and some limited store-related liabilities, while Rite Aid will be granted an option exercisable through May 2019 to join Walgreens' purchasing organization, Walgreens Boots Alliance Development GmbH. Walgreens will also pay Rite Aid a $325 million cancelation fee for the merger.

"We believe this new transaction addresses competitive concerns previously raised with respect to the prior transaction and will streamline and simplify the transition for customers, team members and other stakeholders," Walgreens CEO Stefano Pessina said in a statement.

Walgreens expects modest earnings per share accretion in the first full year after the closing and synergies of about $400 million fully realized within three to four years after the close.

Walgreens is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells WBA? Learn more now.

Read More Trending Articles

More from Mergers and Acquisitions

Goldman Names Dees Co-Head of Investment Banking

Goldman Names Dees Co-Head of Investment Banking

All-Male Boards Could Face New Pressure From Shareholder Adviser ISS

All-Male Boards Could Face New Pressure From Shareholder Adviser ISS

3 Reasons Apple or Alphabet Should Consider Buying Tesla

3 Reasons Apple or Alphabet Should Consider Buying Tesla

Kraft Heinz Has an 'Unsustainable Diet,' Says Morgan Stanley

Kraft Heinz Has an 'Unsustainable Diet,' Says Morgan Stanley

Jim Cramer: The Market Thinks China Will Blink First in Trade War

Jim Cramer: The Market Thinks China Will Blink First in Trade War