Cannabis stocks represent a huge growth opportunity for investors. But they also come with considerable risks, as marijuana is federally banned in the U.S. Its legality in many states, however, has created a unique opportunity for investors to buy shares of businesses running state-level operations.

Five years ago, investing in a multistate marijuana producer such as Green Thumb Industries (GTBIF 3.56%) may have looked like a great idea. After all, if the U.S. legalizes marijuana use, the company could be in an excellent position to grow rapidly and benefit from the operations it has already built up. But it hasn't exactly panned out that way -- legalization hasn't happened, nor is it on the horizon. Green Thumb investors, however, have been some of the luckier ones. Here's how you would have fared if you invested $5,000 in the pot stock five years ago.

Shares of Green Thumb have soared more than 50%

On Jan. 2, 2019, Green Thumb's stock closed at $8.53. If you invested $5,000 in the stock at that price, you would own approximately 586 shares of the cannabis producer. Today, with the stock trading at around $13, your investment would be worth about $7,600, a return of 52%.

But your return would look even better if you'd sold in 2021 when investors were buying up meme stocks and other risky investments. That year, your investment in Green Thumb would have been worth more than $22,000.

Alas, that's the risk that comes with pot stocks -- they can be incredibly volatile. If you own shares of Green Thumb, you're still a lot better off than investors in rivals such as Trulieve Cannabis and Curaleaf Holdings, which are up just 15% and 5%, respectively, over the past five-plus years. And that's still a lot better than the 73% losses Tilray Brands investors have endured, which still outperforms Canopy Growth stock and its awful 98% decline.

Although Green Thumb hasn't outperformed the S&P 500 during the past five years, with the index's returns up around 96%, it has definitely been an exceptional stock to own, given the industry it is in.

What has made Green Thumb Industries so special?

A big reason Green Thumb has been one of the better investments in the cannabis industry is that it is profitable. Not on an adjusted basis as many pot stocks claim to be, but according to generally accepted accounting principles (GAAP). In its most recent quarter (ended Sept. 30), Green Thumb reported net income of $10.5 million on revenue of $275.4 million. And it wasn't a one-off profit; the company has been in the black for three consecutive quarters.

What it does effectively is reach half the U.S. population without having all that many locations. Curaleaf, for example, has 147 dispensaries while Trulieve has 194; Green Thumb recently launched just its 90th.

Green Thumb Industries chart showing where it operates.

Image source: Green Thumb's December 2023 investor presentation.

Recently, many marijuana companies have been scaling back some of their operations to be leaner and more efficient, as investors are more concerned about the bottom line than about sheer revenue growth. This is why Green Thumb may be a more attractive investment option than its peers.

Is Green Thumb Industries stock still a good buy?

Green Thumb Industries is one of the better stocks in the cannabis industry, but it's not a risk-free one. All U.S. pot stocks face challenges because of a lack of federal legalization.

Provided that you're willing to stay invested for the long term (at least several years), Green Thumb could be a good investment given its strong financials. But investors should also remember to temper their expectations. Marijuana legalization is by no means a certainty, and it could be a challenging road ahead for Green Thumb and other cannabis companies.