You can use the option mathescape
for your environment which gives you the ability to use the normal latex behavior of the $-signs. Try:
\begin{lstlisting}[mathescape]
...
\end{lstlisting}
For more info, take a look into the listings
package manual.