A shebang is only really a shebang if the script is executable and "#!" are the first two characters of the file.
The OS is literally looking in the file checking the first two bytes and seeing that they are (in hexadecimal) "23" and "21", which are the ASCII codes for "#" and "!".
If these appear later in the file, or if you're not executing the file directly, the line is indeed treated as a comment because it begins with a #.
In fact, if the line is:
#!/bin/sh
then the OS finds the shebang and therefore runs:
/bin/sh [filename]
and /bin/sh
does ignore the shebang line as a comment when running the script.
When it comes to some other languages that doesn't use #
as a comment, a special flag is often passed to the interpreter so it knows to ignore the first line (e.g. #!/usr/local/bin/tcc -run
).