The winning companies now face the challenges of cultivating the marijuana — the state says all of the drug must be manufactured in-state — while building retail operations. Given the large pool of potential customers, several dispensaries are planned for New York City, including in the Bronx, Manhattan and Queens.

“We think it’s a humongous opportunity,” said Hillary Peckham, who, with her sister and mother, runs Etain, a marijuana business in Katonah in Westchester County. Etain plans to grow the drug in the Adirondack hamlet of Chestertown, and sell its products in Albany, Yonkers, Syracuse and Kingston.

Other winners included Bloomfield Industries, which plans to grow marijuana in Queens and dispense it in Manhattan, Nassau County and two upstate counties; PharmaCann, the abbreviated name of the Illinois-based PharmaCannis, which will grow and package marijuana products in Hamptonburgh, in Orange County, and sell at dispensaries in the Hunts Point neighborhood of the Bronx and in towns near Albany, Buffalo and Syracuse; and Empire State Health Solutions, which will set up its manufacturing facility in a technology park northwest of Albany, and have dispensaries in Albany County and Queens, as well as two other locations.

Sales of medical marijuana will be subject to a 7 percent tax, though economic benefits in some communities may be felt more immediately: Another selected company, Columbia Care NY, plans to create hundreds of jobs at a 204,000-square-foot agricultural operation at the Eastman Business Park in Rochester, growing marijuana where Kodak once ruled the photographic film world. Rochester will also be home to a Columbia Care dispensary.

Nicholas Vita, the chief executive of Columbia Care, said his company would invest “double-digit millions” in growing operations and dispensaries around the state, including one in the northern city of Plattsburgh and in Riverhead, on Long Island. He described the marijuana farm in Rochester as an assembly line of sorts, with multiple strains of the drug being grown in climate-controlled rooms, from seed to bloom to packaging, he said, with testing along the way. “Just like any other pharmaceutical product, there has to be consistency,” Mr. Vita said.