I'm not denying that the cost of living to salary ratio is better in the US. But it is simply false to say that the cost of living in cities like Vancouver (widely considered the most expensive in Canada) is the same as SF or NYC. Rent in SF is roughly double that of Vancouver, which itself has the most expensive rent in Canada.
I only know this because we thought of relocating to Canada
Beyond anecdotes, various comparison websites have rent in SF at around 100% more than Vancouver.
Obviously salaries are lower in Canada and your disposable income can very likely be lower living there if you're in tech.
A fair comparison would compare areas outside of SF with areas outside of Vancouver. There are obviously some outliers like Oakland, but on average you would expect to pay 50%-100% more in rent in the Bay Area than in the Vancouver area.
There is a lot of data available online that you can find very easily. Zillow for example, regarding rent for a one bedroom:
SF average rent: $4,440 USD [1] vs. Vancouver average rent: $2,500USD [2]
Mountain view average rent: $3,395USD [3] vs Burnaby average rent: $1,989USD [4]
Union City average rent: $2400USD [5] vs Surrey average rent: $1689USD [6]
[1] https://www.zillow.com/rental-manager/market-trends/san-fran...
[2] https://www.zillow.com/rental-manager/market-trends/vancouve...
[3] https://www.zillow.com/rental-manager/market-trends/mountain...
[4] https://www.zillow.com/rental-manager/market-trends/burnaby-...
[5] https://www.zillow.com/rental-manager/market-trends/union-ci...
[6] https://www.zillow.com/rental-manager/market-trends/surrey-b...
2. You’re ignoring the option of buying homes which is impossible for Canadian vancouver salaries but still possible with American salaries in the SF Bay Area
Otherwise, as I already stated, we agree that it is almost always better from an economic perspective to live in San Francisco as an engineer, given the vastly higher salaries.
NOTE: I'm specifically responding to your claim that "the cost of living in Canada is just as high or even higher than the US", in the context of HCOL areas where tech workers typically reside.
Honestly I don't know what can convince you, so maybe we can just agree to disagree.