When you buy your phone, if doing online, under the carrier section click "Connect on your own later". This will give you a carrier unlocked phone you can bring just about anywhere with the carrier's sim. If you select a carrier it WILL be locked to that carrier. I made the mistake many years ago buying one for my carrier and it was locked, even though I didn't get any subsidy.
If you go to the store, just tell them you want an unlocked phone and you'll connect to the carrier later and they will do that.