> opting for cashback
For cashback it depends where you live.
In the US, cashback will be likely be wholly or significantly funded by the Interchange Fee that the merchant receives.
The Interchange Fee is the fee the card issuing bank "skims off the top" from the fee the merchant is charged for taking your card.
In the US, interchange typically around the 2% mark. In the rest of the world its more like 0.2%, hence you can only really fund your loyalty programme out of interchange in the US.
Other sources of revenue the card provider can use are any annual fees they charge the customer, any penalties they charge the customer, and of course interest fees charged to cardholders who do not pay off their balance.
If your card company also runs a points scheme, then they can get extra revenue by selling points, either to you directly so you can "top-up" your balance, or in bulk to third-party companies who wish to offer points promotions.
> Like, who's paying for the flights? Consumers, merchants, airlines, banks?
If you are asking specifically about points-accrual card loyalty schemes where the cardholder accrues points which they can then use at a later date for flights, then that is all magical smoke and mirrors.
It boils down to the careful stage management of our old friends supply and demand.
Supply:
The card issuer issues your points. This sits on their balance sheet as a liability (the points are assigned a dollar value).
i.e. at this stage it costs them nothing in terms of hard-cash, just a small technical accounting reduction in profits
When you "buy" your airline ticket on points, the liability crosses the balance sheet (the company raises an invoice to you which is paid with the points).
Demand:
This is where the other half of the magic happens. The company makes sure to limit the ability for you and everyone else to redeem points.
You will have seen this if you have ever tried to book a flight based on 100% points, you'll find very limited availability.
Of course you will have seen companies offer you to pay "part-cash/part-points", but if you look closely, the "exchange rate" on offer is generally very poor value for money.