Let's say I have a credit card1 that awards me with miles for my expenses (each X dollars spent = Y miles earned).
When I use my card to buy products and services, the money goes to the places I spent my money on2, and I get all the correspondent miles.
Then, I can use those miles in whatever airline loyalty program the card allows me to.
Assuming that I have enough miles to book a flight, all of them earned through credit card expenses (which means the airline got no money from me), how can this be profitable or advantageous for the airline?
The only benefit I see is that I'm not flying with their competitors, but I don't understand how the airline can make any money from this, or at least get some advantages other than preventing me from choosing a competitor.
I can understand the advantage, from the airline point of view, when I get miles from flying with them. The airline already got my money on previous flights (in which I could've chosen their competitors, but I didn't), and as a benefit for my loyalty, I've got a "free" flight3.
But when I earn miles from another sources that have nothing to do with the airline (in the example above, credit card expenses), what's the benefit for them? Does the airline make money - or get any other kind of advantage - somehow in this case? Or is preventing me from choosing a competitor the only benefit?
Obviously I'm missing something, as I don't fully understand how loyalty programs really work, where do all those "miles"/points/whatever come from, etc. Hence my question.
1: Credit cards usage is not the focus here, I'm just using it as an example. My question applies to any other mechanism of getting miles other than flying.
2: I'm aware that credit card companies get their share, and there are also fees and taxes, but my point here is that no money - AFAICT - is going to the airline.
3: I know it's not entirely free, there are other expenses such as government/aiport taxes, but AFAIK that money doesn't go the airline. Yes, there are also fuel surcharges, but I guess charging only this wouldn't be enough to be profitable.