Escape $ to make sure it becomes a # when switching to root. (When using single quotes for PS1 a single \ would be enough.)