I had an AT&T one that I had unlocked from a 3rd party. Apple replaced it with another that was unlocked. I use mine on Aio network, so having it unlocked was a must.
The status of a replacement phone from Apple will be exactly what you have today. If it is locked to T-Mobile then so will the new one, if it is unlocked then the new one will also be unlocked.
If you had it unlocked unofficially then the new one will also be unlocked.
I bought my phone originally from Apple. I'll just tell you I'm with Sprint. However I bought mine originally at the Apple Store and mine is unlocked. I'm assuming it's because they didn't have the one I wanted in the Sprint model. Honestly I don't know. I just know mine is unlocked.