In the US, most mobile phones are subsidized by the carrier companies (AT&T, T-Mobile, Sprint, Verizon) so that you get a better price on a new phone in return for entering into a 1 or 2 year contract. To enforce this contract, subsidized phones are often locked to a specific carrier.
When a customer buys a phone without a subsidy, or if the contract has been completed, mobile carriers SHOULD HAVE TO unlock the phone so a customer can use it in any way they want to.
Permanently locking phones is bad for competition between mobile phone companies. If they know they have you locked in for 1 or 2 years, they have less incentive to compete and innovate.
More importantly, it is also bad for consumers. We are forced to pay extra for a freedom that (increasingly) the rest of the world has.



