Image source: Getty Images.

What happened

Shares of refining company Western Refining (NYSE:WNR) climbed 28% in November. The largest reason for the gain wasn't the news that had so many other refiners gaining ground this past month. Rather, it came following the announcement that Tesoro (NYSE:TSO) would be buying Western for $6.4 billion.

So what

Western Refining has been one of the most fascinating refining companies to follow over the past several years. It went from the shareholder value-killing deal of buying Giant Industries in 2006 to a heavily indebted company that made it one of the most shorted stocks on the open market. Slowly but surely, though, it paid down that debt position to the point where it was strong enough to acquire a partial stake in Northern Tier Refining in 2013, only to buy out the remaining stake this past year. 

All of this led the company to have a strong set of refining assets that just happen to be close to the Bakken shale formation and the Permian Basin. As a result, it has some of the most profitable refineries in the country on a gross refining margin basis.

Image source: Western Refining investor presentation.

This is why Tesoro is buying the company. With a much more reasonable debt load than in prior years and a rather enviable set of assets, it adds to Tesoro's position as a westerncentric refining company that is now on par with some of the other major independent refiners in terms of refining capacity. 

For shareholders, the jump in share price correlates with Tesoro's offer price, which is either 0.4350 shares of Tesoro per share in Western or $37.30 per share in cash. That's a decent premium to today's shares, but it's still a bit of a discount compared to prices just a year ago when refining margins were at some of their highest in years.

Now what

While the ink isn't dry on this deal, chances are good that it will be approved. The refining market is a fragmented one in the U.S., and even with the added assets, Tesoro is still much, much smaller than many of the bigger players in the industry. While it doesn't look like Tesoro got a screaming bargain on Western -- the purchase price makes it a deal valued at an enterprise value to EBITDA of 10.9 times -- keep in mind that refining margins over the past 12 months have been very low. As a result, the company's profits have struggled. If we were to see a bit of a reversion to the mean for refining margins, then this deal may look a little better down the road. 

The current stock price is ever so slightly below the cash offer, but certainly not enough for any investor to buy shares now and take the cash when the buyout takes place. There are some advantages to the deal such as a more diverse business with a larger geographic footprint and assets in refining, logistics, and retail. On the other hand, investors are going to take a big hit in terms of dividends -- Western Refining's dividend was 4.1% while Tesoro's is 2.6%.