(Reuters) - Oregon lawmakers sought on Monday to protect buyers of marijuana from possible penalties under federal law, approving a bill to ban sellers of the drug for recreational use from keeping information on their customers.

More than two dozen U.S. states have legalized some form of marijuana for medical or recreational use.

But the drug remains illegal at the federal level, and President Donald Trump's administration has said it may ramp up enforcement of federal laws against its use.

The bill, passed by the Oregon House of Representatives 53-5, bans merchants who sell recreational cannabis from keeping information for more than 48 hours that they collect from identification, such as a driver license, that buyers use to prove they are 21 or older, according to a draft of the law.

The state Senate approved the bill in March. It now heads to the desk of Oregon Governor Kate Brown for her to sign into law.

Sponsors of the bill hope the legislation blocks federal law enforcement officials from learning who buys marijuana in Oregon through subpoena or other legal action.

"I personally am very concerned that we give as much protection to Oregon citizens to ensure that their personal identification information is not somehow compromised," Senator Floyd Prozanski told a committee last month.

White House spokesman Sean Spicer told journalists in February that federal anti-marijuana laws might be ramped up.

Brown and the governors of Alaska, Colorado and Washington - states where cannabis has been legalized - sent a letter in early April to Attorney General Jeff Sessions and Treasury Secretary Steve Mnuchin requesting to work with the administration if they planned to enforce federal marijuana laws.

"We understand you and others in the administration have some concerns regarding marijuana. We sympathize, as many of us expressed apprehensions before our states adopted current laws," they wrote.

Marijuana stores in Oregon would still be allowed to collect personal information from buyers who voluntarily sign up for mailing lists in order to receive promotions such as coupons and discounts. Merchants, however, would be prohibited from selling the information to third parties.

(Reporting by Brendan O'Brien in Milwaukee; editing by John Stonestreet)