Berkshire Hathaway, the conglomerate run by Warren E. Buffett, announced on Wednesday that it had agreed to sell its 31 newspapers for $140 million in cash.

The buyer is Lee Enterprises, the publisher that has been managing the newspaper group’s operations for the past 18 months. Among the organizations being sold are The Buffalo News and a collection of local papers that include The Richmond Times-Dispatch in Virginia.

The deal ends Mr. Buffett’s dalliance with being a news mogul. Berkshire had owned The Buffalo News since 1977 and within the past decade rapidly bought up other papers, consolidating them in a division called BH Media Group.

In a letter to his newspaper publishers in 2012, Mr. Buffett described himself as a newspaper “addict” with designs on buying more papers. But he grew pessimistic about the business more recently because of drops in advertising revenue. In an interview last year, he said most newspapers were “toast.”