This is not iex or “the REPL” treating anything different, this is about the backslash being used to escape things, and elixir, the language, internally normalizes any visual escaping when lexing and parsing string literals. So the relevant AST of "\#" and "#" are simply the same.
Therefore, at the time that this string is inspected, there is nothing to show but the normalized form.
In case of "\\" though, the internal representation is just a single slash. And this is also as what it its printed when doing IO.puts, while the inspection still shows the double slash, as “inspections” are meant to be valid copy/pasteable elixir code most of the time.