Wifi is different from data. It is T-Mobile's data that would cost you. Whatever phone you have, turn "cellular data" off, under settings. Or it may be called "mobile data". That would cost you. If you're at home, or at school - or.... at starbucks, and the location has their own wireless internet (which is wifi), then that would not cost you a cent from T-Mobile.
Data from T-Mobile allows you to use the internet even when you don't have access to wifi.