The agency had taken Amazon to court after the company refused to hand over customer records.
The FBI was investigating a prolific seller of used books on Amazon, and the retailer had refused a request for information about the people who had bought the books.
"The [subpoena's] chilling effect on expressive e-commerce would frost keyboards across America," US magistrate Judge Stephen Crocker wrote in an August 2006 ruling (PDF) which he has just unsealed, according to Associated Press.
"Well-founded or not, rumours of an Orwellian federal criminal investigation into the reading habits of Amazon's customers could frighten countless potential customers into cancelling planned online book purchases.
"It is an unsettling and un-American scenario to envision federal agents nosing through the reading lists of law-abiding citizens while hunting for evidence against somebody else."
The FBI had initially requested details of 24,000 people who had bought books, but this was later narrowed to 120. Amazon turned over many records, but not the information on the customers, citing First Amendment protection.
Assistant US Attorney Daniel Graber decided in April that the company should submit to the request.
But Amazon brokered a deal whereby it would inform its customers of the FBI's request and let them decide if they wanted to help the authorities.
The FBI then withdrew the request, claiming that it had found all the information it needed on a suspect's computer. This enraged the judge.
"If the government had been more diligent in looking for workarounds instead of baring its teeth when Amazon balked, it is probable that this entire First Amendment showdown could have been avoided," he wrote.
The case only came to light after Amazon asked the judge to unseal and make public his ruling, a move that prosecutors objected to strongly.
Cotton seedling freezes to death as Chang'e-4 shuts down for the Moon's 14-day lunar night
Fortnite easily out-earns PUBG, Assassin's Creed Odyssey and Red Dead Redemption 2 in 2018
Meteor showers as a service will be visible for about 100 kilometres in all directions
Saturn's rings only formed in the past 100 million years, suggests analysis of Cassini space probe data
New findings contradict conventional belief that Saturn's rings were formed along with the planet about 4.5 billion years ago