It looks like the interaction of Markdown being performed before MathJax runs, so the two stars end up being turned into marks for italics, and MathJax doesn't process the equation because it contains internal HTML. J.M.'s solution gets you around that. You could also use \*
since that will prevent Markdown from processing the star (and also remove the \
so that it is just a *
when MathJax sees it).
Note that you don't need to do this in the question or answer (just comments), because the comments use a different processor than questions and answers. The Q&A processor has a much more sophisticated understanding of the interaction between MathJax and Markdown, and protects math from Markdown processing.
\ast
. $P\ast q$ $\endgroup$