It shall be unlawful for any person knowingly or intentionally to possess a controlled substance unless such substance was obtained directly, or pursuant to a valid prescription or order, from a practitioner, while acting in the course of his professional practice, or except as otherwise authorized by this subchapter or subchapter II. It shall be unlawful for any person knowingly or intentionally to possess any list I chemical obtained pursuant to or under authority of a registration issued to that person under section 823 of this title or section 958 of this title if that registration has been revoked or suspended, if that registration has expired, or if the registrant has ceased to do business in the manner contemplated by his registration. It shall be unlawful for any person to knowingly or intentionally purchase at retail during a 30 day period more than 9 grams of ephedrine base, pseudoephedrine base, or phenylpropanolamine base in a scheduled listed chemical product, except that, of such 9 grams, not more than 7.5 grams may be imported by means of shipping through any private or commercial carrier or the Postal Service. Any person who violates this subsection may be sentenced to a term of imprisonment of not more than 1 year, and shall be fined a minimum of $1,000, or both, except that if he commits such offense after a prior conviction under this subchapter or subchapter II, or a prior conviction for any drug, narcotic, or chemical offense chargeable under the law of any State, has become final, he shall be sentenced to a term of imprisonment for not less than 15 days but not more than 2 years, and shall be fined a minimum of $2,500, except, further, that if he commits such offense after two or more prior convictions under this subchapter or subchapter II, or two or more prior convictions for any drug, narcotic, or chemical offense chargeable under the law of any State, or a combination of two or more such offenses have become final, he shall be sentenced to a term of imprisonment for not less than 90 days but not more than 3 years, and shall be fined a minimum of $5,000. Notwithstanding any penalty provided in this subsection, any person convicted under this subsection for the possession of flunitrazepam shall be imprisoned for not more than 3 years, shall be fined as otherwise provided in this section, or both. The imposition or execution of a minimum sentence required to be imposed under this subsection shall not be suspended or deferred. Further, upon conviction, a person who violates this subsection shall be fined the reasonable costs of the investigation and prosecution of the offense, including the costs of prosecution of an offense as defined in sections 1918 and 1920 of title 28, except that this sentence shall not apply and a fine under this section need not be imposed if the court determines under the provision of title 18 that the defendant lacks the ability to pay.
As used in this section, the term “drug, narcotic, or chemical offense” means any offense which proscribes the possession, distribution, manufacture, cultivation, sale, transfer, or the attempt or conspiracy to possess, distribute, manufacture, cultivate, sell or transfer any substance the possession of which is prohibited under this subchapter.