There's no straight answer to that question. Still, there's this:http://www.ilounge.com/index.php/articles/comments/determining-which-carrier-an-iphone-is-locked-to/http://www.unlockboot.com/2013/08/check-if-your-iphone-is-unlocked-or.html
The US should adopt the EU policy: after one year into your contract they are required to unlock your phone, when asked. Doesn't matter if you're on a two year contract. A good policy, yet not necessary since almost all telcos sell their contracts with an unlocked iPhone anyway.