Speculation about the Obamas’ books and how much they would sell for have been circulating in the industry in recent weeks, as executives at the top publishing houses met separately with the former president and first lady. Some publishing executives who followed the bidding process said that the opening offers for Mr. Obama’s book alone were in the $18 million to $20 million range.

The publisher plans to donate one million books in the Obama family’s name to First Book, a nonprofit organization that provides books to disadvantaged children, and it will continue to provide digital copies to Open eBooks, which grew out of the 2016 White House digital education initiative. The Obamas also plan to donate part of their advances to charity, including the Obama Foundation.

“We are absolutely thrilled to continue our publishing partnership with President and Mrs. Obama,” Markus Dohle, the chief executive of Penguin Random House, said in a statement. “With their words and their leadership, they changed the world, and every day, with the books we publish at Penguin Random House, we strive to do the same. Now, we are very much looking forward to working together with President and Mrs. Obama to make each of their books global publishing events of unprecedented scope and significance.”

The Obamas’ advance is likely to exceed even the stratospheric figures that other recent presidents and first ladies have received. Former president Bill Clinton sold his memoir “My Life” for more than $10 million, and Hillary Clinton reportedly received an $8 million advance from Simon & Schuster for her memoir “Living History.” George W. Bush’s memoir “Decision Points,” became a hit, selling about two million copies and earning him an estimated $10 million. (Mr. Barnett, a Washington-based lawyer, has handled many of these lucrative deals and represents some of the capital’s most powerful players, including the Clintons; Mr. Bush and his wife, Laura Bush; Speaker Paul D. Ryan and former Vice President Dick Cheney.)

It is unusual, however, for a former president and first lady to make a collective deal for their memoirs, and some publishing industry insiders said that early on the process, it appeared that the books were going to be auctioned separately. (It is possible, and perhaps likely, that the books will be published by different imprints in the Penguin Random House conglomerate, which could also help the company absorb the cost of a large advance, by sharing it between imprints.)