>> legal and recognised by airlines? <<
It's not illegal as far as it being a criminal offense. But it is most definitely not recognized by the airlines, as bartering (buying/selling) FF miles, upgrades, etc. is specifically against the terms and conditions of the frequent flyer programs.
If the airline finds out, they can/will cancel your ticket and you'll have to buy a new one to get to your destination or get home. If you're also a frequent flyer with the airline they'll cancel your FF account and confiscate your miles.
How often does that happen? We don't know, but there's certainly a risk, and the US carriers are paying more attention to this (American has secured an injunction against one of these brokers).
Here are some examples l to illustrate what happens if you're busted dealing in bartered miles, upgrades, etc., to both sellers and buyers.
Edited: 2:56 pm, January 24, 2013