I follow a simple rule about this when I'm the interviewer - any time commitment asked of a job candidate to write code, must be matched by an equal time commitment on my part.
For example, that permits collaborative code questions or white boarding, but not take home code challenges. Past experience has shown me those are always horribly estimated, and require more time on the candidate's part than issuers claim. Put yourself in the candidate's shoes, having 3-5 of these things to work through (unpaid, no doubt, as OP rightfully objects to). Not fun!
I've found that rule a simple, transparent, way of showing respect for candidates' time. Which I've always found admirable, from both sides of the hiring table.