“I say this as the father of a middle school student, where middle schools are one of the fastest growing markets for marijuana sales today,” he told a coffeehouse crowd. “In the black market, they do not ID — they do not care — as long as they can make that sale.”

The 2020 Democratic hopeful who may be most vulnerable on marijuana policy is former Vice President Joseph R. Biden Jr., who in the 1980s and 90s was a leader in the “war on drugs.’’ He championed laws that set tough mandatory minimum sentences for drug offenses, including possessing large amounts of marijuana. This led to an era of mass incarceration, with a lasting economic and social toll for minorities.

“In 1994 Biden had a fairly mainstream position, but in 2020 that position is so far from the mainstream of Democratic politics that it is almost offensive,” said John Hudak, a senior fellow at the Brookings Institution who focuses on state and federal marijuana policy. He called Mr. Biden’s history on criminal justice issues “his biggest liability in the 2020 primary.”

Mr. Biden has apologized for parts of his record, calling a law from the 1980s requiring harsher penalties for crack cocaine than powder cocaine — the former was more popular with African-Americans and the latter with whites — “a big mistake.”

Spokesmen for Mr. Biden, who has told aides he is 95 percent committed to getting into the presidential race, did not respond to requests for comment.

Two Democratic senators opposed to legalizing marijuana at the federal level — Amy Klobuchar of Minnesota, who entered the race last month, and Sherrod Brown of Ohio, who opted out of running this month — represent battleground states in the Midwest, whose politics are less progressive than the coastal states that led the way to legalizing cannabis for adults.