For years after the release of the original Apple iPhone in 2007, it was "locked" to a single cell phone service carrier: AT&T. Furthermore, you had to buy a contract with AT&T, limiting your ability to change phones or plans in the near future. And even when that contract ran out, you couldn't switch carriers on that phone. If you didn't like AT&T, including their contract or what they charged for their services, tough beans. Apple required you to use AT&T as your carrier and, if you wanted to own an iPhone (as about half the planet seemingly did), AT&T was what you had to live with.
That's no longer the case. As most cell phone users know, information about the phone's carrier is contained on a small circuit board called a SIM (subscriber identification module) card that can be moved from phone to phone and replaced if the user changes services. That's why users of most cell phones can use the carrier of their choice. But Apple installed a "SIM lock" (sometimes called a "carrier lock") on the original iPhone that only allowed SIM cards from AT&T to be used. That's why you were stuck with AT&T if you bought an iPhone in the U.S.
Hackers very quickly found ways to get non-AT&T SIM cards into iPhones, a process called "unlocking." But unlocking wasn't approved by Apple and could cause connectivity problems of its own.
Then, in 2011, Apple announced that it was expanding its service to allow Verizon and Sprint versions of the iPhone, though these were still locked to these services. Still later in that year Apple released a genuinely unlocked version of the iPhone, so that users could select the carrier of their choice. Apple fans around the country rejoiced. The new unlocked versions would work with any carrier that used the GSM (Global System for Mobile communications) standard.
So now, if you walk into an Apple store and buy an unlocked iPhone, you're no longer restricted to AT&T, Verizon or Sprint. You can plug in other SIM cards. But you might experience some sticker shock. Let's compare: The Apple price on the locked 16GB phone, which only offers you a choice of AT&T, Sprint or Verizon, is $199. The unlocked version, which allows you to use the carrier of your choice, costs $649. There are comparable price differences on iPhones with more memory, too, up to 64GB.
What the heck? Why should you be forced to pay an extra $450 just to have your choice of phone carriers? It's a legitimate question, but the real question isn't why unlocked iPhones are so expensive. The real question is why locked iPhones are so cheap. And that's because the phone companies are subsidizing Apple's expenses, paying part of the cost of each iPhone just to have you as a customer paying regularly into their network plan. With an unlocked iPhone, no carrier is willing to pick up part of your tab. You have to pay for the phone entirely on your own. But at least you won't be tied down to a contract and can change services at will. It's up to you whether it's worth paying that premium to have the carrier of your choice and, in most cases, no contract forcing you to remain with the carrier.