You can unlock the AT&T M8 to work on T-Mobile or any other GSM carrier. BUT you can't unlock the AT&T M8 or any other GSM M8 for use on a CDMA carrier(Sprint, Verizon)
this also goes for the unlocked one on HTC site.
Sprint and Verizon won't allow it. You will have to buy a Verizon M8 to work on their network and unlock it to use it on GSM. But not vice versa