Perhaps it's because I was less financially literate in the past, but I remember that as being the only way in the 2000s. There might have been laws passed to limit that practice and its abuses.
The smart solution, provided you have enough money, is to buy the phone elsewhere, and take a plan without a phone. It's always less expensive in the long term.
in Germany, the Telco's gave up locking the phones in 2017. Because it was to expensive. I can not remember if it was a hard lock - as in any other sim card is blocked or just their additions to the OS. bought a phone in 2017/early 2018 - Xperia 10, where on the boot screen a Deutsche Telekom logo appears but otherwise the OS unaffected by vendor edits/additions. But updates are really slow since they go through Telekom instead of directly from sony which is already slow.
I know many who can't do math and paid twice the value of the phone for a locked device and some plan they never really used fully.
That has not been the case for a long time. The last phone I had on contract was an iPhone 4.
/me mumbles something about "Kids these days..."