It's because some interviews try to have you solve hard problems, expecting you to have a solution ready in 5 minutes, whereas in the real world you'd consult literature for that.
Whatever happened to, "he seem to be able to code, let's try it for a couple weeks"?
Happened to me twice where everything was fine and then after having been interviewed by 5 or more people, one of them has a bad feeling, and you're not given a chance to prove yourself in a probationary period. Situations like that made me wonder if freelancing is a better path.