Very basically, Amex charges stores/vendors a fixed rate for your purchases, lets say 3% or 3 cents per dollar per purchase. When you want to redeem your points, Amex pays the airline for the FF miles, which is probably under 1 cent per point, though I don't think many people here know that actual cost.
So in essence, merchants pay for the miles, but credit card companies also make a boatload off of interest on balances and fees, which allows them to still be extremely profitable and still give out miles like candy.