I think they do not know if someone is a good programer, beucase they don't have the skills to do so. They check if someone is a good developer. Programming is an activity of development, but development has many others. So they check if you are on time, if your estimations are good, if there are many defects on things you have done in your bug tracking system, your soft skills, commitment, communication, etc.
What some It gurus sometimes forget and get upset about is that our work is not only programming, we have many other things to do that are also very important. While your manager will not take a look on how your code looks like (because it is completely unimportant to him), he will check if you are a team player, responsible, respectful and do a high quality job in overall.
Sometimes I think code is overrated.