Whenever you use a credit card, the merchant pays 2% to 4% to the credit card system as merchant fees*. The amount depends on their contract with their bank, but it often varies by reward card type. For better reward cards, the merchant pays more.
This must be too good to be true. I'm new to credit card rewards programs, so I'm likely overlooking something.
Those miles aren't coming out of thin air; the merchant (read: landlord) pays for them.
The bank is turning around and buying those miles from the airline. And here's a gotcha - "miles" are not the same thing as "an airline gift card". You may find the rates at which miles are redeemed are not that advantageous compared to cash.
Whether to accept credit cards and this arguably-usurious fee structure is a personal decision made by each merchant. It's a complex question, as it depends on particular facts relating to their business and customers. Note that taking cash or checks isn't "free" either - there are internal business costs to any payment method.
There are also costs TO YOU. I had a landlord who wanted me to pay by credit card, but to do that I needed to use their "online system" and to do that I needed to sign their TOS, which included an arbitration clause.
* depending on the arrangement, they are not necessarily a pure percentage. They may have per-transaction fees, batch fees, oh they've got all sorts of fees for many merchant systems. In most fee arrangements, Few but Large transactions (furniture store) have a better effective rate than Many but Small transactions (pizza place).