It all depends on the specifics. Note that all the numbers below are made-up and inaccurate. The math is also fudged a bit, but needs to be simple to easily illustrate the point.
City A has a CoLI (Cost of Living Index) of 1.3 and City B has an index of 1.0.
City A will pay you $130K/year, and City B $100K/year.
You spend $80K/year living in City B, and $104K in City A (80K*1.3 pretending CoLI actually works that way in this case).
In City A, you end up with $26K in savings/debt repayment at the end of a year.
In City B, you end up with only $20K.
If you are able to reduce your expenses from 80K/104K to 40K/52K, the differences jumps from $6K to $18K in favor of City A.
Now, most places won't actually increase your salary by that much for cost of living. Instead of giving you $130K in City A, they'll give you $112. In that case spending 80K/104K gives City B the advantage of 20K vs 8K in savings. While spending 40K/52K makes them equivalent for savings.
There are lots more variables, such as how the CoLI changes for renting vs owning. How your expenses will grow over time as you want to spend more and possibly start/expand your family. The basics are here. It mostly depends on how much of a salary premium the company will pay you to work in City A, and how thrifty you are.
Note that may happen that you can make more savings in City A, so you work there for several years to pay off your debt and develop a nice stock portfolio, then switch to City B and live a more luxorious lifestyle, because things are cheaper. For each of those periods of time, you happen to choose the city that will best suit your expenses versus income.
In conclusion, you'll have to do the calculations yourself to truly know. The hard part is guessing how cheaply/expensively you'll actually live.