The National Enquirer, President Trump’s favorite supermarket tabloid, is about to have a new owner: James Cohen, a son of the founder of the Hudson News franchise. American Media Inc., The Enquirer’s publisher, announced the deal Thursday.

The money-losing title was put up for sale several weeks ago, after its principal owner decided it no longer wanted to be associated with the magazine, according to several people familiar with the matter. The publication attracted the scrutiny of federal investigators for its role in the 2016 presidential campaign.

American Media had been in talks with several potential buyers, including the California billionaire Ronald W. Burkle. After those talks fell apart last week, Mr. Cohen, whose father started the chain of Hudson News shops, swooped in to buy the troubled tabloid.

As part of the deal, American Media, led by David J. Pecker, a longtime friend of Mr. Trump’s, has also agreed to sell two of its other tabloids: the Globe and the National Examiner. The Washington Post first reported the sale, which it pegged at $100 million.