Ahh yes i forgot the iPhone 5 only the Verizon iP5 is completely unlocked no matter what for any GSM network,but thats only because they use the LTE band that requires net neutrality.Sprints doesn't so sprints iP5 can be unlocked but only for international use the sprint phone has MNC/MCC blocks to not accept sims from the US as does the verizon iPhone 4S
Yes, when talking about a 4S only an unlocked AT&T 4S or factory unlocked GSM 4S will work with Tmobile in the US.
The unlocked verizon and sprint iphone 4S will work with any gsm sims outside of the US.
In the US it will not recognize any US carriers sim card.
So make sure you get an AT&T unlocked 4S, not a verizon or Sprint 4S.