While the written application (particularly the application letter, if there is one) highlights the candidate's writing skills, the interview highlights the candidate's interpersonal skills in a face-to-face (and, let's be honest, stressful) situation. Those are two very different sets of skills, of course, and I have seen how a candidate who looks very good in one situation (such as "on paper," in the initial written application) can fail miserably in another situation (such as in a face-to-face interview).
In a recent search on my university campus, one candidate did very well at the interview because he remained calm and presented himself as interested, accessible, and familiar. He talked about how his family was from the general area, for example, and even spoke with more than a hint of the regional dialect. The other candidate may very well have been a better "fit" with our university (he teaches the very sorts of courses that we need, while the other candidate does not), but he failed to make this personal connection with most of the members on the search committee and was clearly very nervous during his presentatoin.
The entire search process, too, is usually pretty short, and the selection committee is asked to make important decisions with limited time and limited information. I'm not surprised that the wrong candidate is hired sometimes and the right one is turned away. I suspect this sort of thing happens more frequently than most of us might like to think!