Federal law makes it illegal for any person who does not have a license to write prescriptions to sell or give a prescription drug to another person (21 U.S.C. § 841(a)). Licensed health care professionals, such as doctors or pharmacists, cannot knowingly sell or give prescription drugs to someone who does not have either a valid need or valid prescription for the drugs. “Selling†does not necessarily mean a cash transaction; instead, “selling†can include giving or exchanging a prescription drug, as well as an offer or agreement to sell or exchange (21 U.S.C. § 802(8)).
...
The penalties for the illegal sale of prescription drugs vary, depending on where the case was prosecuted (federal charges carry the same penalties, no matter where in the country the prosecution occurs, but each state has its own sentencing provisions). A conviction for an illegal sale of prescription drugs carries rather heavy penalties. Selling illegally is treated much more seriously than simply possessing a drug illegally. As a result, while a possession conviction could result in a fine or a misdemeanor record, an illegal sale conviction generally results in a felony record along with a prison term.
http://www.criminaldefenselawyer.com/resources/criminal-defense/drug-possession/selling-prescription-drugs-illegally.htm