I have withdrawn from job applications in the past because of this. There are many organisations eg universities, where it is a legal requirement that the job has to be open to outside applicants, and that an individual wasn't just be offered it internally.
Now I am all for internal promotions, and if someone can do the job (and often IS doing the job) and the Powers-that-be want to keep them, then that's fine - BUT - I'm not prepared to waste my time and energy applying for posts where the appointment is a done deal. Apart from anything else, it means that I will never know whether I didn't get the job because the internal candidate was genuinely the best suited or because s/he is in situ, everybody likes them, and the boss prefers the devil they know.
It's not fair on applicants who may have put a lot of work into preparing for interview (and getting their hopes up, and travelling to the venue etc) when there is no realistic chance of their getting the job.
I gave my apologies and withdrew from one interview once because I had reliably heard that an internal candidate was ear-marked for the position, but because of the stupid fannying-about policy of our organisation (it was in another department for the university I already worked at) she couldn't be appointed without an interview, and she couldn't be interviewed unless there was at last one other applicant (ie - me!).
I got a really snotty phone call from a secretary (not even the department head*) complaining that I was stopping them from filling the position, and that this person was now left in limbo and had been doing the job and was entitled to know where she stood etc. I presume that she and the secretary were either particularly pally, or that it was now causing difficulties for the secretary otherwise she wouldn't have got involved. Whatever the reason, I just politely declined. I have no idea whether the other woman was permanently appointed or not.
*I am not being snobby when I mention the call was from a secretary - it's just that a secretary doesn't have the authority to hire and fire, and so had no real reason to try to get me to attend. Perhaps management had asked her to - if so, it was the wrong thing to do.