Saying \hfil
is the same as saying \hskip 0pt plus 1fil
or, in LaTeXspeak, \hspace{0pt plus 1fil}
.
However, TeX uses the stretch component only if it has to. For instance, in
\hbox{a\hfil b} % Plain TeX
\makebox{a\hfil b} % LaTeX (or \mbox{a\hfil b})
the stretch component will do nothing and there will be no space between “a” and “b”. Conversely, a spacing will appear with
\hbox to 2cm{a\hfil b} % Plain TeX
\makebox[2cm][s]{a\hfil b} % LaTeX
because TeX wants to occupy the stated length.
A formula in display math is typeset at its natural width, so glue will use only the length component and not the stretch component. The length component for \hfil
is zero.
If you want to fill all the available space, you should say
\[
\makebox[\displaywidth][s]{$\displaystyle\phantom{*}a\hfil{*}$}
\]
but it's surely better to say
\[
a\tag*{$*$}
\]
using amsmath
features.
\hbox{a\hfil b}
; display math material is typeset at its natural width, so glue doesn't stretch. – egreg Oct 10 '14 at 20:20