I would guess, as I said, that towns simply compete for the business by making them an attractive offer. For example even when selling the ground for the warehouse towns could give Amazon a cheaper price while hoping for more future income in taxes. Presumably that would apply to other companies as well.
The bit about "paying to destroy mainstreet" is of course nonsense. Amazon's business would exist either way.
I guess it would be comparable to countries trying to attract businesses by giving them tax breaks?