I think there should be some effort made to not over generalize. I'll talk about some less popular kinds of video game programmers.
At one end of the scale, game programmers can be hobbyists who do their thing in their free time, release their work as freeware, and not make any profit. People might do this as a way to practice their skills, to produce a portfolio of work, and also out of community spirit.
Prior to the golden age of video games, before the big software houses were formed, this was a very common method of development for commercial games. Individuals might contact a publisher with a game they had privately made, and if the publisher was impressed, they would be contracted to refine it, and produce a couple more games. But this doesn't tend to happen nowadays.