In America, if you discuss why a candidate was rejected and your reasoning can be interpreted as one of the many reasons that have been deemed illegal, you open up your company to being sued for discrimination.
This happened at a company where I worked. A candidate who was rejected emailed and asked why he didn't get the job, and one of the interviewers replied that he had a thick Indian accent (coincidentally, the interviewer was also Indian), and that would make it difficult for customers to understand him. He sued and later settled out of court for a rumored 6 figures. After that, rejections were handled automatically via snail mail direct from corporate.
That said, I don't find it likely that someone will sue you for saying, "we need someone who has more experience with <language/framework> or <type of project>", which is what many rejected candidates are looking for when they ask why they are being passed on. I mean, on what grounds would they sue?
I guess the fear is that seemingly harmless feedback could be twisted by an unscrupulous candidate (or his/her lawyer). For example, "we need someone with .NET experience" in an extreme interpretation could mean "we want people who can afford Microsoft licenses, not poor programmers who can only afford free software", and now you're looking at discrimination based on economic background. That is obviously an absurd example, but it is better to say nothing at all to the candidate than to have to waste time and money in court or on a settlement.
Even if there were no absurd lawsuits (which certainly do happen), you cannot realistically expect 100% of your interviewers to be 100% educated and 100% consistent while giving feedback to lots and lots of candidates. The cost of a single suit is high enough that you must take the risk of someone ever slipping up with an off-hand comment very seriously. The only way to reliably prevent mistakes is to reliably prevent any form of feedback.
It's unfortunate because I'm sure many people I interview would appreciate feedback and I would be quite happy to give it to them. But, the aggregate risk across all candidates is too high.
This happened at a company where I worked. A candidate who was rejected emailed and asked why he didn't get the job, and one of the interviewers replied that he had a thick Indian accent (coincidentally, the interviewer was also Indian), and that would make it difficult for customers to understand him. He sued and later settled out of court for a rumored 6 figures. After that, rejections were handled automatically via snail mail direct from corporate.