From what company can i flash the iphone 5 into tmobile?

How much would it be if i buy the iphone 5 and flash it into tmobile but first i need to know from what company do i buy it and any other suggestion or anything else i need to know?

Your options would be to buy the iPhone 5 outright from Apple as a factory unlocked model, which would be the simplest to set up with T-Mobile, as all you need to do is to install the SIM card and verify that the APN settings are correct.

You could transfer an AT&T iPhone 5 to T-Mobile, after getting the phone unlocked by AT&T. Then it is the matter of installing the SIM card and verifying APN settings.

Other carrier's iPhone 5's are program locked to the carrier, and are much harder to transfer to a different carrier legally, especially in light of the latest DMCA ruling which makes it harder to unlock phones.