If you do a military residency, then it does count as active duty, and you get paid quite a bit more. But, you also accrue additional payback time, year for year, but only up to 4 years. So, even if you do a 5 year residency, you'll still only owe 4 years as an attending. SO...sort of semantics, really because, even though it counts...it doesn't change anything.
GMOs are slightly different depending on the branch of military. In AF, if you dont match military(which you have to rank #1, like any other branch) and you dont "match" for a civilian deferment, you have to do a 2-3 year flight surgeon tour, which allows you to gain points so that you are more likely to match after. Those years do count as payback though, so not horrible I guess.
(I may have some of the details a bit wrong, but thats the gist of it)