What happened

In a megadeal announced this past weekend, Oneok (OKE 0.55%) and Magellan Midstream Partners (MMP) are combining forces to create one of the largest oil and gas infrastructure companies in the U.S. The two pipeline stocks, however, aren't receiving the same love from the markets today: While shares of Magellan were surging 15% as of 11:20 a.m. ET Monday, Oneok stock was down 7.7% as of that time.

So what

Oneok will acquire Magellan Midstream in a cash-and-stock deal valued at nearly $18.8 billion, including assumed debt. The deal is expected to close in the third quarter. Every Magellan Midstream shareholder will receive $25 in cash and 0.6670 shares of Oneok for every Magellan share they own. The implied value of $67.5 per share, based on the closing prices of both stocks on May 12, represents a 22% premium for Magellan Midstream shareholders.

That explains why shares of Magellan Midstream are surging today. Crude oil and natural gas prices have tumbled this year on fears of a recession and oversupply. Receiving a 22% premium on their shares, therefore, looks like a lucrative offer.

Oneok shareholders, on the other hand, appear miffed to see their company pay a hefty premium and take on more debt in a weak oil and gas price environment. In hindsight, though, this could prove to be a smart move for Oneok for two big reasons.

First, the acquisition will hugely diversify Oneok's product mix, adding crude oil and refined products pipelines to its existing natural gas business. That will pitch Oneok against diversified midstream giants like Enterprise Products Partners and Kinder Morgan.

Second, Oneok expects the acquisition to boost its free cash flow per share by an average of more than 20% between 2024 and 2027. The company can use that cash to not only pare debt, but also grow its dividends and repurchase shares.

Oneok has paid a dividend every year for more than 25 years now, and increased its dividend per share by a compound annual growth rate of 12% between 2000 and 2023. Although Oneok maintained a steady dividend payout between 2020 and 2022, it resumed dividend growth with a 2% raise earlier this year.

Now what

With Magellan all set to become a 100% subsidiary of Oneok, income investors may feel let down, since the master limited partnership's high yield – it stands at 7.6% now -- has been a major attraction for investors so far.

They needn't worry, though, if they remain invested in Oneok. That's because Oneok is a financially strong company with a great dividend track record and a high yield of 6%. Oneok is also firing on all cylinders -- it earned record net profit in its first quarter.