Only the Apple Store sells unlocked iPhones and they are almost more than twice as expensive as locked ones. You will be able to use a SIM from almost any carrier that has one avilable for the iPhone you purchase. SOme features will not work on those carriers that do not officially support the iPhone.
In some cases you will not have to sign a long term contract with a carrier. As an example, with ATT, if you "bring" your own unlocked iPhone, you will not be forced to sign a 2 year contract. You will be able to cancel service without any penalties.
Also, you can swap SIMS with an unlocked iPhone, say if you travel to other countries other than your own. You can buy prepaid SIMS from that country, saving on roaming charges, which can be expensive.
Please note that some stores sell an "SIM free" iPhone, which is not the same as an unlocked phone. A SIM free iPhone will usually lock to the carrier of the first SIM inserted when activating it. If that happens you will only be able to unlock the phone by contacting the carrier it is locked to.
Hope this helps.