Apple has reached a settlement in a civil class-action lawsuit brought against it by U.S. states and consumers who claim the company overcharged shoppers by $280 million for eBooks. 

By settling Apple avoids a jury trial that was scheduled to start next month, in which the company faced paying as much as $840 million in claims, The Wall Street Journal reported.

The terms of the settlement are sealed and still need the court's approval. In addition, Apple won't pony up until it appeals last year's ruling, in which Judge Denise Cote found that the tech company violated antitrust laws by conspiring to raise eBook prices with five major publishers. Apple has said it will appeal Cote's decision, taking the case all the way to the Supreme Court, if necessary.

Related: Why UPS Should Be Very Afraid of Amazon's Delivery Plans

"Any payment to be made by Apple under the settlement agreement will be contingent on the outcome of that appeal," Steve Berman, the plaintiffs' attorney, wrote in a letter to Judge Cote.

Back in April 2012, the U.S. government sued Apple and five big-name publishers, including Simon & Schuster and Hatchett, alleging that the tech company and the publishers had conspired to make eBooks more expensive for consumers.

Essentially, Apple and the publishers tried to change the way eBooks were priced. Up until then, publishers sold eBooks to retailers who, in turn, were able to reset the price. Known as the "wholesale model," this allowed Amazon to buy eBooks and turn around and sell them to consumers at a lower price point -- typically $9.99 -- in an effort to increase its already massive market share.

All this price slashing scared publishers, who worried that once Amazon gained a monopoly on the eBook market, it could dictate eBook prices across the industry. (Forward thinking, publishers!)

Related: Stephen Colbert Throws Punches at Amazon

In anticipation of the iPad's launch, the U.S. government claimed that the five publishers met with Apple to negotiate contracts that would allow them to set eBook prices. (Apple would then take a 30 percent cut of each sale). Known as an "agency model," the terms barred retailers from lowering the eBook prices, which the publishers typically set at $12.99 or $14.99.

The U.S. government alleged that Apple was instrumental in the collusion to raise prices across the industry.

As The Wall Street Journal noted, Walter Isaacson's biography of Steve Jobs, then the CEO of Apple, corroborates this account. From the biography, here's Job's on Apple's negotiations with the publishers: "We told the publishers, 'We'll go to the agency model, where you set the price, and we get our 30%, and yes, the customer pays a little more, but that's what you want anyway.'"

Book publishers have long argued that an "agency model" increases much needed competition in the struggling industry. Currently, they're exactly where they never wanted to be: At the mercy of Amazon.

Related: Report: Tech Giants to Pay $324 Million to Settle No-Hiring Lawsuit