If you only have 100k miles in a program, no status and don't care about lifetime elite, there's not much risk to you in selling. However, if you have 1,950,000 lifetime AA miles and are thinking of selling 100,000 AA miles, then it's probably not worth the risk.
There's not much chance that you'll get caught, especially if you work out a story the other person. How difficult is it to make sure the other party says the award was a gift? Also helps if they know your name so they can answer the question "Who gave you these 100k miles?"
And selling miles is certainly not illegal.