buying miles direct from airlines is (for the programs that I know: miles&more, Mileage Plus) expensive, and most often also limited quantity wise.
but indirect there are ways to get unlimited amounts of miles.
my preferred examples is getting miles&more miles through swiss Coop Superpunkte (Superpoints). The Standard conversion rate is 2 Coop points = 1 mile. But so far once or twice a year they are promotions that let me transfer 3 Coop points into 2 m&m miles.
Currently unlimited amounts of Coop Superpoints can be bought through (swiss) auction plattforms like Ricardo (my preferred one) or ebay for about 1,2 swiss cents per Coop point.
I did accumulate several million miles for myself in the past 4 years, and also several million miles for family members and over 100 Million miles for third persons.
Buying/selling/trading Coop points follows all rules, contrary to selling miles for award tickets (which is against Frequent-flier-program rules).
On FlyerTalk we post and discuss this option in the miles&more (swiss) forum.
Here is a link to such a discussion.