They lock phones because carriers are willing to pay off someone’s phone so people jump ship. It’s a pure anticompetitive practice.
Frankly, it's absurd to pay laptop prices for a phone.
Further, as noted by multiple commenters (and this can be confirmed by a google search turning up numerous accounts): T-Mobile automatically locks an unlocked device when you insert an AT&T sim into it.
Which is bizarre. T-Mobile doesn’t own the device. They don’t even have a SIM in it.
This should read as “T-Mobile has entered into an agreement, which should be against public policy and illegal, such that the device vendor locks the device under certain circumstances.”
The idiotic thing about locked phones in the USA is that they're given to customers who are ON CONTRACT. Therefore, if the customer takes his phone to another network, he still has to pay the original one! Why on earth would the phone company want to prevent people from paying for service they're not even using?
The sheer stupidity of this behavior is almost worse than the offensiveness of the entire phone-locking concept.
As others have noted, that's why there is a contract in place - if you don't pay the monthly bills, they can seek to recover the costs from you.
Also, what you're saying would do nothing to stop someone selling the phone to another customer on that carrier.
There are fewer carriers than phone makers. And the anticompetitive benefit accrues to carriers.
The customer shouldn't have to take any sort of action to remove the lock.
pushing unstoppable modifications, retroactively altering the device without consent, stuffing features with antifeatures, turning the device into something it wasnt at the time of sale, these actions should be banned for phones, as well as any other product.