ELI5: How is Amazon able to sell me books so much cheaper than brick and mortar book stores in my area - eviltoast

I like shopping in book stores. There’s something about wandering the aisles and waiting for a book to jump out at you that I can’t get shopping online. Unfortunately, whenever I compare the price of a book Amazon has every in-person store beat, often pricing their offerings 30%-50% lower (or around $10/book in my experience) even when I go to a large chain like Barnes and Noble.

How is it that Amazon is able to afford to offer the books so much cheaper and also support all of the infrastructure involved in shipping it to my doorstep compared with in-person stores?