Has anyone else ever heard of such a policy? Can you explain the
reasoning behind such a policy?
I don't really understand how screening candidates on the most
objective and job-related criteria possible could increase the risk of
I have never heard of such a policy. In fact, virtually every place I have ever worked had some form of "test" during every interview.
I can't explain the exact reason your HR has such a policy - for that you need to ask them. I'm sure they have a reason behind it, although it may not be a reason with which you agree.
If I had to guess, they are worried that your "testing" isn't applied equally to all candidates, and/or might be biased toward one group over another, increasing the risk of a discrimination lawsuit. This is something that is hard to realize when you are doing it. You might think your "tests" are objective, but HR might think that are not. HR might be trying to avoid a problem, and perhaps going overboard.
Your HR rep might advise you that asking for coding examples would be appropriate if and only if that coding is specifically the kind used in the job at hand. Or, HR might be just trying to avoid coding tests that aren't relevant to the job.
One of HR's roles is to avoid lawsuits resulting from interviews. If you are in the US, I'm sure during your training, you were told not to ask people if they were married, how old they are, or anything that might lead to a discrimination suit. That's HR's influence.
In our litigious society, it's difficult to interview and avoid "risky" questions, but it's important to try hard. The fact that you are actually being trained on how to conduct interviews is a factor that could be used in your defense of a lawsuit.
Try to see this from HR's point of view, and ask them about the thinking behind their suggestions.