I've done this in the past with jobs for which I was not accepted. Some were happy to, some weren't, but where they did it was useful.
And as an employer now, I'm generally happy to share useful feedback. But I'll usually only bother if the candidate asks me. This is at least partly because - as RiderOfGiraffes alludes to, there are legal issues involved, and I have to think very hard about how I word a reply to make sure it stays within the bounds of relevant laws. And I'm happy to do that if the candidate asked after it - but not if they've expressed no interest.
(fwiw, this is in the UK)