I had similar experiences with every group project, where one or two people have to do all the work. I asked a teacher about it once, and his explanation is that it's a lesson for working in the real world. Really drives home the saying "those who can't do, teach". I think it would have been more moral to do what your teacher did and actually validate contribution, instead of intentionally teaching students that you can screw around at someone else's expense and get away with it.
Back in college, for 90% of the "team projects", I just assumed that I had to do all the work solo, and nobody else would contribute.
One of my friend had a 3-person team, and one of the teammate kept procrastinating, and one day before the deadline, decided that he would just take a "fail", leaving the other two teammates completely in despair. It was a hardware-related project and without 1/3 of the work, nothing could be bought together at all. And the professor didn't give a shit; they had to beg to get a 60/100, despite having done their work perfectly.
The big difference between group projects and real life work, is that the professors don't really have a stake in whether the work is being completed. In real jobs, the boss would really care about it if one of the colleagues just refuse to work and cause the whole product to fail to launch.