It’s because some booksellers use an automated pricing system.
Suppose Retailer A doesn’t actually have a copy of a book. They can set their software to search for advertised prices for the book in question and then display a price a few percent higher than anyone else’s , then if a punter actually orders the book, they can buy it from one of the others, and still make a modest profit (determined by the percentage markup).
Retailer B, who actually has a copy of the book and wants to ensure a sale by undercutting the competition, advertises it at a little below the top asking price (which of course is Retailer A).
If B’s offer comes in within the range that A has decided would provide insufficient profit, A’s software responds by increasing its price to restore the desired profit; B’s software then increments its price…. and the price for some obscure book reaches the realms of astronomy.
This mostly seems to happen with unusual books where there is no clear idea of likely demand and therefore no way of actually determining a realistic clearing price (short of the intuition and experience of an old-school bookseller).