Information wants to be free. That observation, first made in 1984, anticipated the internet and the world to come. It cost nothing to digitally reproduce data and words, and so we have them in numbing abundance.

Information also wants to be expensive. The right information at the right time can save a life, make a fortune, topple a government. Good information takes time and effort and money to produce.

Before it turned brutally divisive, before it alarmed librarians, even before the lawyers were unleashed, the latest battle between free and expensive information started with a charitable gesture.

Brewster Kahle runs the Internet Archive, a venerable tech nonprofit. In that miserable, frightening first month of the Covid pandemic, he had the notion to try to help students, researchers and general readers. He unveiled the National Emergency Library, a vast trove of digital books mostly unavailable elsewhere, and made access to it a breeze.

This good deed backfired spectacularly. Four publishers claimed “willful mass copyright infringement” and sued. They won. On Friday, the publishers said through their trade association that they had negotiated a deal with the archive that would remove all their copyright books from the site.

“The proposed judgment is an appropriately serious bookend to the court’s decisive finding of liability,” said Maria Pallante, chief executive of the Association of American Publishers. “We feel very good about it.”

The archive had a muted response, saying that it expected there would be changes to its lending program but that their full scope was unknown. There is also an undisclosed financial payment if the archive loses on appeal.

The case has generated a great deal of bitterness, and the deal, which requires court approval, is likely to generate more. Each side accuses the other of bad faith, and calls its opponents well-funded zealots who won’t listen to reason and want to destroy the culture.

In the middle of this mess are writers, whose job is to produce the books that contain much of the world’s best information. Despite that central role, they are largely powerless — a familiar position for most writers. Emotions are running high.

Six thousand writers signed a petition supporting the lawsuit, and a thousand names are on a petition denouncing it. The Romance Writers of America and the Western Writers of America joined a brief in favor of the publishers, while Authors Alliance, a group of 2,300 academics whose mission is to serve the public good by widely sharing their creations, submitted a brief for the archive.

It’s rarely this nasty, but free vs. expensive is a struggle that plays out continuously against all forms of media and entertainment. Neither side has the upper hand forever, even if it sometimes seems it might.

“The more information is free, the more opportunities for it to be collected, refined, packaged and made expensive,” said Stewart Brand, the technology visionary who first developed the formulation. “The more it is expensive, the more workarounds to make it free. It’s a paradox. Each side makes the other true.”

Universal access to all knowledge was a dream of the early internet. It’s an idea that Mr. Kahle (pronounced “kale”) has long championed. As the United States lurched to a halt in March 2020, he saw an opportunity. The Internet Archive would be a temporary bridge between beleaguered readers and the volumes shut away in libraries and schools.

It didn’t turn out that way, not a bit — the emergency library shut down in June 2020 — and three years later Mr. Kahle remained angry and frustrated. There was one bright spot. The Board of Supervisors of San Francisco, the capital of Silicon Valley, had just passed a resolution in support of digital libraries and the Internet Archive.

The resolution was largely symbolic, but the message was exactly the one that Mr. Kahle had been trying to get across without much success, particularly in court. It championed “the essential rights of all libraries to own, preserve and lend both digital and print books.”

“Libraries came before publishers,” the 62-year-old librarian said in a recent interview in the former Christian Science church in western San Francisco that houses the archive. “We came before copyright. But publishers now think of libraries as customer service departments for their database products.”

Librarians are custodians. Mr. Kahle has spent his career working in tech, but he wants the future to behave a little more like the past.

“If I pay you for an e-book, I should own that book,” he said. “Companies used to sell things. Media companies now rent them instead. It’s like they have tentacles. You pull the book off the shelf and say, ‘I think I’ll keep this,’ and then the tentacle yanks it back.”

Some necessary background: When a physical book is sold, the “first sale” provision of copyright law says the author and publisher have no control over that volume’s fate in the world. It can be resold, and they don’t get a cut. It can be lent out as many times as readers demand. The information in the text flows freely through society without leaving a trace. Religions and revolutions have been built on this.

Thanks to their digital nature, e-books are treated much differently. They can’t be resold or given away. A library that wants to lend e-books must buy a license from the copyright holder. These subscriptions can be limited to a number of reads, or by periods of a year or two. Everything is tracked. Libraries own nothing.

The Internet Archive’s lending program, developed long before the pandemic, involved scanning physical books and offering them to readers in its Open Library, a practice called controlled digital lending.

One reader at a time could borrow each scanned book. If the library or one of its partners had two copies, two readers at a time could borrow it. The archive defended making its own e-books by citing fair use, a broad legal concept that permits copyrighted material to be quoted and excerpted, and the first-sale doctrine: It could do what it wanted with its own books.

No dice, wrote Judge John G. Koeltl of U.S. District Court in Manhattan. His decision granting summary judgment for the publishers in March went far beyond the pandemic library. Any benefit for research and cultural participation, he said, was outweighed by harm to the publishers’ bottom line.

The Internet Archive lost its court battle at a moment of rising concern about whether tech, entertainment and media companies are up to the job of maintaining the public’s access to a wide-ranging culture. Warner Bros. Discovery, for example, wanted to scale back its Turner Classic Movies cable channel, a citadel of cinema history and art. It was stopped by an uproar.

New technology means culture is delivered on demand, but not all culture. When Netflix shipped DVDs to customers, there were about 100,000 to choose from. Streaming, which has a different economics, has reduced that to about 6,600 U.S. titles. Most are contemporary. Only a handful of movies on Netflix were made between 1940 and 1970.

Libraries have traditionally been sanctuaries for culture that could not afford to pay its own way, or that was lost or buried or didn’t fit current tastes. But that is at risk now.

“The permanence of library collections may become a thing of the past,” said Jason Schultz, director of New York University’s Technology Law & Policy Clinic. “If the platforms decide not to offer the e-books or publishers decide to pull them off the shelves, the reader loses out. This is similar to when songs you look for on Spotify are blanked out because the record company ended the license or when movies or television shows cycle off Netflix or Amazon.”

The triumphant publishers — HarperCollins, Penguin Random House, Hachette and John Wiley & Sons — declined to comment through the Association of American Publishers. In its “reflections” on the case, the publishers’ group said it was simply protecting the rights of writers.

“In the world of publishing, authors are our heroes,” it said.

The publishers association said the archive was unrepentant and impossible to negotiate with: It “refused to halt or engage in discussions, and after being sued, it chose to accelerate its activities.”

Mr. Kahle denied refusing to negotiate. “They never approached us — they just sued,” he said.

The Authors Guild, which submitted a brief on behalf of the publishers, said Mr. Kahle and his supporters needed to recognize that rights available to owners of physical books simply did not make sense in the digital era.

“Digital is different than print because it is infinitely copyable and unprotectable,” said Mary Rasenberger, the chief executive of the guild and a copyright lawyer. “If anyone could call themselves a library, set up a website and do the exact same thing the archive did, writers would have absolutely no control over their work anymore.”

Traditional libraries promote discovery, but publishers perennially worry that they cost sales.

“Most publishers are not purely profit-driven,” Ms. Rasenberger said. “If one were, you could imagine it might not allow libraries to have e-books at all.”

The Internet Archive is best known for the Wayback Machine, which allows access to web pages of the past. Mr. Kahle is a longtime fixture in digital information circles, an enthusiast whose zeal is palpable.

He was an entrepreneur of information in the 1990s, culminating in a search and web analysis engine called Alexa, after the Library of Alexandria. Amazon bought Alexa in 1999 for $250 million, years before it introduced a personal assistant with the same name. Mr. Kahle turned his full attention to the archive, which he founded in 1996 and now employs about a hundred people. It is supported by donations, grants and the scanning it does for other libraries.

In 2021, when the archive celebrated its 25th anniversary, Mr. Kahle talked about the fate of the internet in an era of megacorporations: “Will this be our medium or will it be theirs? Will it be for a small controlling set of organizations or will it be a common good, a public resource?”

The archive had been lending book scans for years. Publishers did not like it but did not sue. What made the pandemic emergency library different was that the brakes were removed. If 10 people, or 100 people, wanted to read a particular book, they could all do so at once.

The emergency library “was as limited as a small city library’s circulation level,” Mr. Kahle insisted. “This was always under control.”

But it did not appear that way to the writers who took to Twitter to point out that the books in the library were written by human beings who were often poorly paid and not benefiting from this free information at all.

Margaret Owen, an author of popular books for young adults, wrote in a 23-post broadside on Twitter that offering up free books to an audience that could afford to pay for them was, “at this point in history, cutting into our money for hospital and/or funeral bills.”

The publishers sued over 127 titles, many by well-known writers, including J.D. Salinger, Sylvia Plath, James Patterson, John Grisham and Malcolm Gladwell. They asked damages of $150,000 per book.

Some writers had second thoughts. N.K. Jemisin and Colson Whitehead deleted their critical tweets. Ms. Owen, asked last month by The New York Times if she stood by her tweets, responded by making her account private. Chuck Wendig, a science fiction writer, tweeted in the heat of the moment that the emergency library was “piracy.” He was quoted in news reports and criticized by archive fans, and now has a post expressing regrets.

Mr. Wendig says he had no part in the lawsuit and does not support it. Three of the plaintiffs are his publishers, but they have “very little regard for me and do not listen to me at all,” he wrote in a blog post.

Some writers — ones who generally do not depend on their writing to make a living — were always against the suit.

“Authors of all types fight constantly against the risk of digital obscurity; for many readers, especially younger readers, if a book is not online, it effectively does not exist to them,” wrote Authors Alliance, which is based in Berkeley, Calif., in its brief in support of the archive. (Mr. Kahle is on the alliance’s 25-member advisory board but played no part in the brief.)

A third group of writers have continued and even deepened their opposition to the archive.

Douglas Preston, a best-selling thriller writer, pretty much single-handedly led a wing of the writing community in opposition to Amazon and its founder, Jeff Bezos, when the bookseller was embroiled in a dispute with Hachette several years ago. Mr. Preston, a former president of the Authors Guild, now sees Mr. Kahle and his philosophy as more of a threat than Mr. Bezos.

“Capitalists may be obnoxious and selfish and in firm need of restraint, but the truly dangerous people in this world are the true believers who want to impose their utopian vision on everyone else,” Mr. Preston said.

Writers, he added, “are subjected to disparagement and online abuse whenever we defend copyright or push back on the ‘information wants to be free’ movement. On tech websites we’re told we’re selfish, we’re Luddites, we’re elitists.”

Among the many points on which the two sides disagree is how many libraries across the country were lending scans of copyrighted material. Only a few, say the publishers, who paint the Internet Archive as an outlier; many, says the archive, which argues this is a broad trend.

Karl Stutzman is the director of library services at Anabaptist Mennonite Biblical Seminary in Elkhart, Ind. He recently had a request from a faculty member for excerpts from a 30-year-old theology text to use in a class in Ethiopia, where the seminary has students. No e-book was available, and a query to the publisher went nowhere.

In the past, the library would have cited fair use and provided scans to the students via secure software, but after the March court ruling, Mr. Stutzman said, it’s unclear what is allowed. One chapter? Two? How many students can see a scan? Fifty? Five?

“I’m caught between enforcing the current legal paradigms around copyright and allowing my colleagues to have academic freedom in what they assign students to read,” Mr. Stutzman said. He plans to tell teachers that they need to choose material that is easy to license, even if it is not necessarily the best, until there is more legal clarity.

That clarity would come from an appeal, which Mr. Kahle said he intended to mount. In the meantime, it’s business as usual at the archive. The National Emergency Library may be history, but the Open Library division still offers scans of many books under copyright. Loans are for one hour or for two weeks “if the book is fully borrowable,” a term that is not defined.

Some of that is likely to change soon.

The agreement filed on Friday went far beyond dropping the 127 titles from the archive to also removing what the publishers called their “full book catalogs.” Exactly how comprehensive this will be is up to the judge.

A separate deal between the publishers association and the archive will provide an incentive for the archive to take down works by any publisher that is a member of the trade group. The incentive: not getting sued again.

In the wake of the publishers’ success, other parts of the Internet Archive have become a tempting target. Universal, Sony, Arista and other music companies sued the archive in New York on Friday, saying it “unabashedly seeks to provide free and unlimited access to music for everyone, regardless of copyright.” The plaintiffs cite 2,749 violations, all recorded with an antiquated format used before 1959, for which they are asking $150,000 each.

“Now the Washington lawyers want to destroy a digital collection of scratchy 78 r.p.m. records, 70 to 120 years old, built by dedicated preservationists in 2006,” Mr. Kahle said. “Who benefits?”

In a 1996 book available through the Internet Archive, David Bunnell, an early software chronicler of the personal computer revolution, said Mr. Kahle was “brilliant” but “very introspective and unsure of himself.”

“If he had Bill Gates’s confidence, he would change the world,” Mr. Bunnell said.

Mr. Kahle is more sure of himself now, and quite determined to change the world.

Asked if he had made any mistakes, he ignored the question and returned to the attack: “I wish the publishers had not sued, but it demonstrates how important it is that libraries stand firm on buying, preserving and lending the treasures that are books.”