It's 3 years for Army... Idk about navy or air force.
For civilian program:
If you go to a moderately priced program, then it'll end up on where you practice. If you go to a middle of nowhere place, you'll make up the difference in about a year.
If you go to a program that pays you, like the VA Manhattan, then you'll come out ahead within a few months of private practice.
If you decide to go practice in a super saturated area, then you may come out somewhat close to the military program + payback.
Tldr; depends on the program tuition + where you want to work, it varies