I don't think there's any inherent "Google thinks a link to a certain type of site is spam" algorithm or whatever. Vendors don't sell to those sites because they always, without question, end up going the spam route or are spammed later. They try to buy your links to get authority and trust so they can absorb the spam better later. That's nothing to do with Google and everything to do with people protecting their assets from spammers.
But there are legitimate casino sites and legitimate pharma sites as well. Often they end up spammed by competitors though. They also are higher up the food chain in each niche, often representing the brands or are a big health or entertainment brand, etc.
The supreme court just ruled that sports betting is now legal and fine nationwide in the US. That legitimizes the industry big time. Google's not going to not-rank things in those SERPs. They'll apply their spam detection algorithms and try to show quality results, just like any other niche.
Same here, for cannabis, vaping, and a lot of these "edgy" industries... they're further and further being legitimized by the law itself. Google can't have an inherent bias. The only thing they care about is if you're spamming links and doing on-page stuffing and spinning and all that.
I have personal experience with clients in the cannabis industry that have done very well with building backlinks on niche relevant sites with niche relevant blog posts.
Here in Canada, the government is set to legalize the drug for recreational use and the industry itself is booming. Unlike certain sectors, such as cryptocurrencies or pharmaceuticals, which is liked to scams, frauds, fakes and multiple warnings from banks and other industry groups, cannabis does not have that "taint".
It would be counterproductive for Google to penalize cannabis sites.