Note the very careful word choice there!
Sure, noone has been able (or possibly even seriously tried) to make selling miles illegal. (Given that illegal means in breach of law)
Pretty clear however that such activities are clearly stated in many (most? all?) programs as being in breach of the Terms and Conditions one has, by definition, agreed to when signing up for said program.
Right or wrong, fair or unfair if the program T's & C's say you can't sell the miles then using weasel words such as "but it isn't illegal" will hardly help the person who is refused carriage on an award identified as having been obtained by such a breach....
How likely that is to actually happen I have no idea.
Doesn't seem ethical, right or proper however (to me, YMMV of course) to AGREE to such conditions and then flout them.