Companies think regurgitating leetcode is better... the number of problems that can be asked is quite large. Memorizing that search space in itself takes tenacity and a good memory...of which are signs of a good employee (regardless of their current coding skill set)
I think the trick here is have people talk through what it does, how and why (as in what are the tradeoffs, what other approaches could have been taken, etc).
You can't fake this. Or to put it better, even if the code isn't yours and you can do this well, it doesn't even matter that the code isn't yours as in doing this you by definition have the skills and knowledge to reimplement it anyway.
Yes I've done this both as an interviewer and interviewee, it's a pretty valuable exercise I've found. Not a silver bullet, not the only thing you can do, not appropriate for every situation, but generally good.
Regarding your other point I agree with you, but if the main point is to evaluate understanding then the difference doesn't really matter. If you're testing for ability to invent concepts etc, then this might be more important to you.
Even at the ML level, engineering is more about applying known good techniques and less about new innovative ideas.