On one end it can be impressive to write code from scratch. On the other, sometimes they just want someone to get the job as soon as possible.
There is a whole range of algorithms (say topological sort, transitive closure, or suffix trees) that will send me immediately to look at an algorithms book or to look up an implementation in the standard or extended library. (e.g. pypi, npm and the maven central repository count as "the extended library")
There's something nice about sorting algorithms from the viewpoint of algorithm theory (usually you can prove that they always make forward progress) but almost any coder today will use the 𝚜𝚘𝚛𝚝() function from the stdlib.
Interviewers come in all shapes and shades, best to ask at the start of the problem. Sometimes you are being evaluated more on your questions and thinking than on getting the right code or answer.