Investing in certain stocks based on the belief that a specific candidate will become president of the U.S. isn't a new idea. For example, when Ronald Reagan was a presidential candidate in 1980, his promise to rebuild the military made defense stocks seem like a good bet for those who thought that he would win. Barack Obama campaigned in 2008 on making healthcare more widely available. For anyone who thought the then-senator from Illinois would be victorious, it would have made sense to buy hospital stocks.

Another uniquely charismatic candidate is running for U.S. president in 2020 -- the independent senator from Vermont, Bernie Sanders. If you think that Sen. Sanders will be sworn in as the next U.S. president come January 2021, don't invest in defense or hospitals. Instead, buy marijuana stocks.

Sen. Bernie Sanders

Image source: Bernie Sanders Senate website.

Day-one priority

Presidential candidates often lay out what, if elected, they plan to do on their first day in office. Just a few days ago, Bernie Sanders told an Iowa audience one of his day-one priorities: Legalize marijuana in all 50 states.

Thirty-three states have already legalized medical cannabis. Eleven of those states also allow the legal use and sale of recreational marijuana. But marijuana remains illegal at the federal level in the U.S.

Sen. Sanders intends to revoke the federal ban on marijuana with one stroke of the pen. His plan is to use an executive order that would make marijuana legal throughout the U.S. effective Jan. 20, 2021.

The Vermont senator has already provided some details about what he wants to do. He'd like to vacate and expunge all past convictions related to marijuana. He wants to tax legal marijuana, and use $50 billion of the revenue raised to fund new federal programs, focusing mainly on minority communities that have been negatively impacted by past drug policies.

Which stocks to buy?

There's a good chance that many marijuana stocks would rise should Bernie Sanders be elected U.S. president. However, some of those gains could be only temporary. Some of those initial winners might turn out to be losers in a Sanders administration.

Sen. Sanders has stated in the past that he won't "allow marijuana to turn into Big Tobacco." He wants to keep any marijuana company from gaining too big of a market share.

Bernie Sanders' Democratic Socialist perspective could make it tougher for the current multistate U.S. cannabis operators to expand as much as they'd like. He could also implement hurdles that make it harder for the big Canadian companies from dominating the U.S. market, as they do in their home country.

I suspect that the most successful marijuana stocks with Sanders as president would be the ancillary players that support the cannabis industry. Three of the biggest and best of these are KushCo Holdings (KSHB), Innovative Industrial Properties (IIPR -0.37%), and Scotts Miracle-Gro (SMG 0.72%).

KushCo is a top supplier of packaging solutions and vaporizer products for the cannabis industry. The company also provides extraction services for extracting cannabinoids such as CBD (cannabidiol) from cannabis plants. Innovative Industrial Properties (IIP) is the leading cannabis-focused real estate investment trust (REIT). Scotts Miracle-Gro's Hawthorne Gardening subsidiary is the No. 1 supplier of gardening products to the cannabis industry.

If Bernie Sanders becomes U.S. president, all three of these companies should benefit tremendously. Demand for KushCo's and Scotts' ancillary products for the cannabis industry would likely soar. IIP would probably see more opportunities as smaller cannabis producers, which would thrive in a Sanders presidency, look to keep their capital costs down.

Carts, horses, and eggs

I'm writing this as the Iowa caucuses are still underway. By the time you read this article, Sen. Sanders could have scored a major victory in Iowa -- or suffered a big setback to his campaign. Either way, two old sayings are worth keeping in mind: Don't put the cart before the horse. And don't count your eggs before they hatch.

Even if Bernie Sanders racks up delegates in the early states, there's no certainty that he will go on to win the Democratic nomination. And even if he becomes the Democratic Party nominee, there's no guarantee that he will defeat Donald Trump -- especially considering the dynamics of the Electoral College.

Because of this uncertainty, the smartest thing to do is to invest only in stocks that should perform well regardless of who wins the presidency. The good news is that ancillary marijuana stocks should be successful in either scenario.

My view is that Innovative Industrial Properties and Scotts Miracle-Gro are better picks than KushCo. Both IIP and Scotts are already profitable; both also pay attractive dividends. Whoever the next president is, I suspect that these two marijuana stocks still have plenty of room to run.