Las Vegas gaming company MGM Resorts International (MGM) - Get Report on Tuesday agreed to buy out its 50% partner in Atlantic City's Borgata Hotel Casino & Spa just days after the state of New Jersey approved a bailout package that will help the cash-strapped city's gaming industry.

MGM would pay activist target Boyd Gaming (BYD) - Get Report $900 million for the half of Borgata it doesn't already own and also assume the hotel and casino's remaining $600 million in liabilities. MGM, in turn, will sell Borgata's real estate to the MGM Growth Properties (MGP) - Get Report real estate investment trust it created earlier this year for $1.175 billion in a sale-and-leaseback agreement.

"While the market continues to experience challenges, Borgata has outperformed and differentiated itself as the undisputed leader in the city. Our decade-long partnership with Boyd Gaming has been a great one," said MGM Chairman and CEO Jim Murren in a statement.

The state legislture passed, and Gov. Chris Christie signed, a bailout last week. The measure gives the city five months to get its finances in order or the state will step in. In the meantime, the state will give Atlantic City $75 million in loans and allow it to receive at payments from casinos rather than property taxes for the next 10 years.

The seaside city is reeling after competition from other casinos in New York, Pennsylvania, Connecticut and other states hammered interest in Atlantic City and led to the closure of four of its 12 casinos.

The MGM-Boyd deal is expected to close in the third quarter.

Last month Boyd became the target of activist investor Land and Buildings Management, which wants the company to fold its real estate investments into a REIT similar to MGM Growth. The same activist had pushed MGM to create the REIT, which raised $1.05 billion on April 19 by selling 50 million shares. MGM retained more than 70% of the REIT.

Boyd said it would have proceeds of about $600 million from Tuesday's agreement once it's paid off associated debt.

In the 12 months ended March 31, Borgata had sales of $812 million and Ebitda of $212 million.

MGM had hired investment banks in 2010 to shop its half of Borgata as it feuded with New Jersey regulators about one of its partners. It was unable to find a buyer at agreeable terms.

MGM shares closed Tuesday at $22.86 while Boyd closed at $18.91.