C'mon, the answer is obivous. But I'll indulge you.
Almost any business strategy will have an upside and a downside. The airlines obviously feel on balance the upside is greater.
Remember too that marketing partnerships benefit both parties. Selling miles creates customers. "Non-paying" customers to some extent, but it still reinforces their brand selection.
The biggest advantage probably is that the airlines can control capacity. They sell the miles at a fixed price, but can "buy" them back (through awards) in a way that costs them the least actual dollars-out-of-pocket.
Yes, they periodically devalue the award chart, but that's not solely related to selling miles. And if they have issues with the elite fliers, they can boost the elite bonuses or make availability better for them.
I'm happy they do this. If they didn't, I couldn't use all the tricks I learn from this board to run up my mileage balance. I'd rather earn 250K miles a year without flying and have a devalued award chart, than earn 0K miles on a better award chart.