The quality of the code is a function of its cost, too.
For example, the code written for NASA hardware (i.e.: space shuttles), have more documentation than the size of the hardware itself (so, we're looking at a large pile of documents next to the shuttle). It's tested for years, it only works on tested CPUs (i.e.: 20 years old proven 8086s), and the actual "waterfall" method (which is generally a disaster for any other project) is properly applied.
That total brings the cost of each source code line to average $1000. (Same for medical appliances, etc).
The cost of a commercial off the shelf software is much (much much) less than $100.
But, even under such strict control, we had to debug the Mars rovers due to unforeseen bugs during their initial flight.
Anybody here on Slashdot can do the math, and fill in the gaps to calculate the future price of games (for a reference they are $60/unit now).