There are a million titles, so no physical store will be able to compete with a warehouse. There are no refrigeration or unusual logistics with books. They are fungible: generally speaking, one book is as good as another, identical book.
It’s quite simple: generally standardized product sizes and media mail. Don’t think it’s farfetched to say Amazon benefited greatly from USPS in its early days.