Through the end of June, the broad-based S&P 500 had gained 16% on a trailing-12-month basis. Considering that stocks have historically risen by 7% annually, inclusive of dividend reinvestment and adjusted for inflation, this isn't a return that investors are complaining about. But if you think that's good, take a look at marijuana stocks, which have, in many instances, doubled or tripled in value over the trailing 12 months.

Why marijuana stocks are leaving the broader market in the dust

Why on Earth are marijuana stocks such a hot commodity? Rapidly changing public opinion is one predominant reason. According to a 2016 poll from Gallup and an April 2017 survey from CBS News, favorability toward legalizing pot nationally has hit a new all-time high of 60% and 61%, respectively. A separate survey from Quinnipiac University in April found broad support for legalizing medical cannabis, with 94% of respondents in favor of such a move.

Legal sales growth figures are also exciting investors. ArcView Market Research tabbed North American legal marijuana sales at $6.9 billion in 2016, and it expects them to more than triple by the time 2021 rolls around. Considering that $46.4 billion in North American sales last year were conducted entirely on the black market, there's a steady opportunity to move customers from illegal channels to the legal market in the years to come.

Even legislative actions have investors excited about the future of cannabis. On June 19, 2017, Mexican President Enrique Pena Nieto signed a medical cannabis bill into law, joining Canada in legalizing medical pot. Furthermore, Canada is in the process of debating legislation introduced by Prime Minister Justin Trudeau that would legalize recreational marijuana as early as July 1, 2018.

In short, there are tangible reasons to be excited about the marijuana industry's long-term growth prospects.

However, marijuana stocks can still be dangerous

At the same time, there are also a laundry list of reasons to stay far, far away from pot stocks. For example, marijuana is still an illicit substance throughout much of North America. The U.S. federal government views it as having no medical benefits, and it's therefore wholly illegal.

This United States' Schedule I categorization of marijuana comes with a number of inherent disadvantages for U.S. businesses and pot stocks. To begin with, researching cannabis for medical purposes is exceptionally difficult because of its Schedule I status. Also, pot-based businesses are unable to take normal corporate income-tax deductions since they're selling a federally illegal substance. Finally, banks want little to do with marijuana companies, leaving many cannabis companies to deal solely with cash, which is a major security concern and a growth inhibitor.

But there's more to it than just scheduling disadvantages. Marijuana stocks themselves are, in many cases, not that fundamentally attractive. Most pot stocks trade on the over-the-counter (OTC) exchanges where up-to-date information may be hard to come by. Though OTC exchanges have improved greatly from a decade ago, reporting standards are still relatively lax compared to more reputable exchanges like the New York Stock Exchange (NYSE). This can make finding accurate cash flow and balance sheet data difficult.

A majority of marijuana stocks are also losing money. Since marijuana is still an illicit substance, there are few guarantees that pot company business models are even viable over the long run.

Four marijuana stocks that should be profitable this year

Nevertheless, there's no denying the recent growth we've witnessed in legal cannabis sales. This means marijuana stocks that are profitable on a recurring basis may be worth a closer look by investors. Based on data from dozens of fiscal 2017 quarterly reports, the following four pot stocks look like a good bet to turn a profit this year (or in their 2017 fiscal year).

1. Aphria

A common characteristic you'll notice of this bunch is that they're Canadian medical marijuana producers and retailers. Aphria (NASDAQOTH: APHQF) is one of them. Aphria has been profitable for an impressive five straight quarters, and the company is currently working on a mammoth expansion of its growing capacity. The $100 million Phase IV project will expand capacity to 1 million square feet and help produce an estimated 75,000 kilograms of cannabis each year. With Canada considering a recreational legalization, this expansion has been timed perfectly.

In its second-quarter report, Aphria wound up delivering $3.9 million in sales, which was nearly double what it reported in Q2 2016, along with a 70% adjusted gross margin and nearly $775,000 in adjusted EBITDA. Still, without the benefit of a one-time revaluation of its long-term investment portfolio during the second quarter, Aphria is probably on track to produce a net profit of only around $3 million in 2017, yet it's valued at $535 million. That's pricey!

2. Canopy Growth Corp.

The Canadian marijuana stock with the highest market cap, Canopy Growth Corp. (NYSE:CGC) is also on track to turn a profit this year. Like Aphria, Canopy Growth is benefiting from growth in Canada's medical marijuana market, as well as its ability to export some of its production to overseas markets where medical cannabis is legal (Aphria does this, too). More recently, Canopy Growth acquired Mettrum Health, which boosted its customer reach within Canada, and purchased 472,000 square feet around its headquarters for the purpose of expanding its grow capacity.

According to its fiscal third-quarter press release, sales grew by 180% year over year to $7.5 million, while the number of registered patients grew by more than 260% to over 29,000. Through the first nine months of fiscal 2017, Canopy Growth had produced roughly $3.5 million in net income. Once again, while encouraging, Canopy Growth is currently valued at $963 million, making this one expensive stock.

3. MedReleaf

Another profitable pot stock is MedReleaf (NASDAQOTH: MEDFF) (TSX:LEAF), which was the largest North American marijuana IPO yet. MedReleaf, like Aphria and Canopy Growth, is a producer of medical cannabis for Canadian patients. It's using the $74 million it raised from its recent IPO to help fund expansion at its facility in Bradford, Ontario. Once complete, MedReleaf believes it'll be capable of 35,000 kilograms of annual cannabis production.

However, unlike its peers, we know for sure that MedReleaf will be profitable in 2017 since it already reported its fiscal Q4 and full-year results last week. Full-year sales for the company jumped by 109% to $31.1 million, while adjusted EBITDA climbed 200% to $10.7 million. But once more, MedReleaf looks fairly expensive compared to the broader market. Its valuation of $560 million dwarfs its adjusted EBITDA.

4. Scotts Miracle-Gro

Finally, emerging marijuana stock Scotts Miracle-Gro (NYSE:SMG) should generate some very healthy profits in fiscal 2017. A majority of Scotts' business (about 90%) comes from its traditional lawn and garden care products. This portion of its business is cyclical, prone to the ups and downs of weather patterns, and often slower growing. The remainder of its business is focused on hydroponics and is much faster growing. According to the company's updated guidance last month, sales at its Hawthorne Gardening subsidiary were up 17% year to date through May.

Though weakness in Scotts' traditional lawn and garden business led the company to lower its full-year guidance in June, sales are still expected to grow by 3% to 4% in 2017, and the company anticipates reporting $4.10 to $4.30 in full-year EPS. Scotts isn't reliant on marijuana for a large portion of its sales and profits, but with its hydroponics sales soaring and its investments in cannabis growing, it's certainly worthy of inclusion here.