Dirty, expensive to extract and trapped by a lack of pipelines, Canadian oil sands can be a tough investment proposition. Yet a year of elevated oil prices has turned companies mining them into cash machines.

Soaring energy prices are set to reward almost everyone producing hydrocarbons: Major oil companies and U.S. shale producers reported record free cash flows in 2021 and should do even better this year. Analysts polled by FactSet predict that a subindex of U.S. oil and gas exploration companies in the S&P 500 will beat last year’s bounty by an impressive 35%. Impressive, that is, until compared with Canadian oil sands producers: Suncor Energy, Canadian Natural Resources, Imperial Oil and Cenovus are set to increase their free cash flow by 60.5% this year, on average.

There are two factors driving this dynamic: First, oil sands require hefty investment upfront but output holds steady for decades with relatively modest maintenance capital expenditures. The opposite is true for shale deposits, which take less upfront spending but, due to quick decline rates, require continuous investment into drilling and well completion to keep oil flowing. Capital expenditures have stayed relatively consistent for Canadian oil producers over the years—through boom and bust cycles—compared with U.S. producers, whose spending has fluctuated wildly. Thomas Liles, analyst at Rystad Energy, notes that, given the maturity of the oil sands sector, reinvestment rates, or the percentage of cash from operations spent on capital expenditures, should be in the 20%-30% range this year and next. That frees up a lot of cash for dividends and repurchases. Suncor, for example, doubled its dividend and bought back 6% of its shares in 2021.

Second, the task of separating extremely heavy crude oil from sand is energy intensive and leads to higher operating costs. That is generally a disadvantage, but it creates more operating leverage: Each dollar increase in oil prices generates a higher boost in profits. Suncor’s cash operating costs for its oil sands operations were roughly $20 a barrel last year; for U.S. shale producer EOG, that cost was closer to $10 a barrel.

One offset to higher oil prices are Canadian royalty structures. Matt Murphy, analyst at Tudor, Pickering, Holt & Co., notes that the Canadian oil companies must pay royalties to the Alberta province on a sliding scale, which can range anywhere from 25% of net revenues when oil prices are 60 Canadian dollars a barrel or cheaper, equivalent to $47.50, to 40% when oil prices reach C$120 a barrel. U.S. royalty rates tend to be fixed as a percentage of revenue.

Royalty payments notwithstanding, Suncor, Canada’s largest oil sands producer, is expected to increase its free cash flow by more than 60% this year on just a 7.6% increase in capital expenditures, according to estimates polled by FactSet. EOG Resources, one of the largest independent U.S. exploration and production companies, is set to increase free cash flow by 21% but it will take 16% more in capital expenditures to get there. That isn’t completely priced in—oil sands producers’ free cash flow yield is higher than U.S. producers.

Longer term, the bull case for carbon-heavy Canadian oil is shakier and will depend in part on a shift to a more nuanced view of environmental, social and governance concerns. Oil sands’ carbon footprint is high, but Russia’s invasion of Ukraine has brought social concerns to the forefront—Western oil majors almost immediately pulled out of Russia—as well as the perils of relying on autocratic regimes for vital commodities.

Energy investors today are laser-focused on two things these days: Immediate cash returns and ESG alignment. At the moment, Canadian oil companies are ticking the first box. A paradigm shift in ESG could really supercharge their shares.

Write to Jinjoo Lee at jinjoo.lee@wsj.com