if UPS/FedEx want to offer flat rate shipping to both densely and sparsely populated areas, it's on them to make it economic. if amazon wants to take advantage of their business model, I don't see anything unfair about it.
USPS is a government agency though. if they ship stuff to rural areas below cost, that is the US government subsidizing rural communities. with mail still being the lowest-common-denominator means of communication, there is a public good argument for burning money to deliver mail/packages affordably to people in these areas. I do agree they should feel at least some of the cost though, and I also feel there is something distasteful about amazon exploiting this cost structure.