SAN FRANCISCO/NEW YORK (Reuters) - With marijuana legalization measures on the ballot in nine states Tuesday, investment opportunities are attracting money from Wall Street, Silicon Valley and publicly traded companies.

An unnamed worker waters cannabis plants on Steve Dillon's farm in Humboldt County, California, U.S. August 28, 2016. REUTERS/Rory Carroll

Much of the new money is avoiding direct investment in marijuana cultivation and sales, which remain illegal under federal law. Instead of getting their hands “green,” new investors are putting their money into ancillary products, such as fertilizer, grow lights, software and payroll services.

Investors new to the sector said they are eager for a piece of a market that, by some estimates, will reach $50 billion over the next decade and are looking for ways to claim profits while minimizing legal risks. (For a graphic on states voting on marijuana, see: tmsnrt.rs/2fBzYmV)

Philadelphia sports empire scion Lindy Snider said she invested in startup Kind Financial, a firm that makes software to keep growers and retailers in compliance with shifting regulations. Silicon Valley angel investor Fulton Connor said he put money into a web marketplace linking growers and stores.

Scotts Miracle-Gro, a publicly traded gardening product manufacturer, has spent hundreds of millions of dollars to acquire companies that sell soil, lighting, fertilizer and other products to marijuana growers. Scotts’ chairman and CEO Jim Hagedorn told Forbes that marijuana was “the biggest thing I’ve ever seen in lawn and garden.”

And Microsoft Corp is partnering with Kind Financial to develop the part of its compliance software that will allow government regulators to track marijuana from farm to market.

Investors said they hope getting in early will serve them well in the long run. If California legalizes recreational marijuana use Tuesday, “we think it would triple the size of the legal market,” said financial services firm Cowen and Company analyst Vivien Azer.

If the federal government also were to legalize marijuana, large corporations would likely flood the zone, and getting a foothold would be far more difficult, said Connor, the angel investor. At that point, he said, new entrants would “want to buy rather than build” new companies, and early investors would be able to sell their businesses and reap the profits.

A GROWTH INDUSTRY

After growing steadily in 2013 and 2014, marijuana-related investment surged in 2015 when the number of U.S. industry deals more than doubled over the previous year; the 99 deals totaled more than $200 million in new investment, according to data compiled by CB Insights.

This year, the pace has slowed a bit as investors await election outcomes, but the analytics firm calculated 2016 is on track to post about 80 deals totaling nearly $100 million.

Large Wall Street firms also have started to take notice and provide guidance to their clients. Merrill Lynch issued a report on medical marijuana opportunities last year, and, in September, Cowen released an encyclopedic look at the industry, projecting the legal market would grow to as much as $50 billion in a decade, up from $6 billion now.

For investors to realize marijuana’s full potential, the Cowen analysts and others have concluded, federal law would need to be brought into alignment with state legalization laws.

Federal tax and banking rules, as well as federal narcotics laws, make operating dispensaries and growing marijuana difficult and unpredictable, even in states where such businesses already are sanctioned. Many banks won’t work with them because their operations violate federal law.

Still, several marijuana investment funds are near or have exceeded $100 million. Private equity firm Privateer Holdings announced this week it had finished raising $40 million this week, taking its total to $122 million.

FINDING A NICHE

The new investors in marijuana-related industries have a variety of reasons for putting money into the sector. Snider, an entrepreneur whose late father owned Philadelphia sports teams and stadiums, said she invested in several companies and funds after she founded a line of skincare products for cancer patients and became interested in marijuana’s potential for skin care.

She was an early investor in Kind Financial, the Microsoft partner that makes compliance software because she saw an opening to help marijuana companies become “more businesslike.”

Snider said she expects to make other investments as well.

“Right now I’m looking at about nine companies,” she said. “There are so many good ones.”

RISK TOLERANCE

Some investors are moving closer to the leaf than others. Former Goldman Sachs health industry banker Rick Kimball, for example, has put about $1 million into marijuana companies, including Chooze, which is creating new pot brands.

The company will not actually handle the marijuana. But it will sell vaporizer pens with Chooze’s LucidMood brand to licensees who will sell them after loading them with company-approved extracts of THC, marijuana’s physiologically active ingredient.

“It allows you to produce products, which are cannabis products but let somebody else, the licensees, deal with the regulatory issues and the regulatory conflict we have between the feds and the states,” Kimball said.

Chooze CEO Charles Jones said the company is confident it can avoid federal laws banning marijuana sales, but he acknowledged prosecutors could try to build a conspiracy case.

“If the feds ever decides to go after people, you know, we won’t be in the first round,” Jones said.

He said the company’s business plan will allow it to be nimble, moving quickly into new markets as they become legal.

New companies sometimes have to adapt to thrive, however, and that can add risk.

Connor led a group of Silicon Valley “angel” investors who focus on young companies into marijuana investments. The Sand Hill Angels group focused on ancillary enterprises, including software and biosciences, making a six-figure investment in Tradiv, an online marketplace that connects growers and stores, Connor said.

Tradiv does not handle marijuana itself, instead contracting out deliveries. Recently, it has begun considering bringing distribution in-house in light of what Chairman Aeron Sullivan described as “tacit consent” from federal law enforcement.

While federal law prohibits the sale and distribution of marijuana, the U.S. Justice Department has said it would defer to states that sanctioned the drug, so long as the states set up and enforce “strict” regulatory schemes.

Still, Connor said his angels were not interested in testing such murky legal waters.

“For us it’s a technology play,” he said. “We don’t want to be breaking the law.”