This is the primal form of the SVM hypothesis :
$$
h _{\mathbf{\vec w}, b}(\mathbf{\vec x}^{(i)}) = \mathbf{\vec w}\cdot \mathbf{\vec x}^{(i)} + b
$$
The Representer theorem as formulated here expresses the optimal weight vector as a linear combination of the training examples :
$$
\mathbf{\vec w}^{*} = \sum_{i=1}^{m}\mu_{i}^{*}y ^{(i)}\mathbf{\vec x}^{(i)}
$$
This can be derived using the Lagrange multiplier method.
Now, the dual form of the SVM hypothesis is given as :
$$
h _{\boldsymbol{\vec \mu}, b} = \sum_{i=1}^{m}\mu_{j}^{*}y ^{(i)} \langle\mathbf{\vec x}^{(j)}, \mathbf{\vec x}^{(i)}\rangle +\, b ^{*}
$$
Here, we have clearly substituted the weight vector $\mathbf{\vec w}$ using the Representer theorem.
However, the weight vector in the original SVM hypothesis is not the optimal weight vector. So, why can we substitute the weight vector in the primal form using the Representer theorem?