Barnes & Noble founder Leonard Riggio will give up $29 million to the bookseller in order to settle a shareholder lawsuit that challenged the company's acquisition of a college textbook division that Riggio and his wife used to own.

The settlement was reached just days before the lawsuit was set to go to court this week.

Riggio and his wife Louise owned Barnes & Noble College Booksellers Inc. before selling it to Barnes & Noble in 2009 for $596 million. At the time the deal was made, Riggio, who is also the company chairman, agreed to cut the purchase price to $514 million.

The shareholder lawsuit alleged that Barnes & Noble overpaid and that board members breached their fiduciary duties by approving the buyout because it increased Barnes & Noble's brick-and-mortar locations even as consumers were shifting rapidly to electronic books.

"We are very pleased with today's settlement on behalf of Barnes & Noble. We believe the transaction as originally structured was unfair to the company, and are happy the company will receive this compensation," Michael Barry, a Grant & Eisenhofer P.A. partner and co-lead counsel on the lawsuit, said in a statement on Wednesday.

The law firms Grant & Eisenhofer and Chimicles & Tikellis helped to reach the settlement.

Barnes & Noble has increasingly tried to boost its position in the growing electronic books market and reached a deal in April with Microsoft Corp. to help it along. Microsoft will invest $300 million to help create a subsidiary for Barnes & Noble's e-book and college textbook businesses, giving it a long-desired foothold that space. Microsoft will get a 17.6 percent stake in the venture.

The deal will help New York-based Barnes & Noble compete with top electronic bookseller Inc.

The settlement still needs the approval of the Delaware Court of Chancery.