Hund's first rule is based on non-relativistic quantum mechanics without any spin-orbit interactions. Since the non-relativistic Hamiltonian (in the absence of magnetic fields) is spin-independent, all $2S+1$ states of a spin multiplet of given $S$ have the same energy. This means that you are always free to assume that you work with the highest weight member of the multiplet for which $M_S=\langle\hat{S}_z\rangle=S$ (all unpaired electrons being spin-up). So there is no contradiction: maximizing $M_S$ (basically maximizing the number of unpaired spin-up electrons in a configuration of given subshells) is equivalent to maximizing $S$. If you are interested, see this answer of mine for some further details concerning Hund's first rule.
Addressing the comments
About your $3d^5$ example (Mn$^{2+}$): this configuration indeed represents the maximal $M_S=5/2$ member of the $^6S$ ground state. But this ground state is sixfold degenerate! Its possible $M_S$ values range from $-5/2$ to $+5/2$, the lowest and highest $M_S$ members really being just five up/down "arrows in boxes":
$$
|^6S_{M_S=+5/2}\rangle=
{\cal{A}}(|3d_{-2} \, 3d_{-1} \, 3d_{0} \, 3d_{+1} \, 3d_{+2}\rangle)\otimes|\uparrow\uparrow\uparrow\uparrow\uparrow\rangle \ ,
$$
$$
|^6S_{M_S=-5/2}\rangle=
{\cal{A}}(|3d_{-2} \, 3d_{-1} \, 3d_{0} \, 3d_{+1} \, 3d_{+2}\rangle)\otimes|\downarrow\downarrow\downarrow\downarrow\downarrow\rangle \ .
$$
However, the other members cannot be represented like this, they are non-trivial linear combinations whose Clebsch-Gordan coefficients are determined by rotational+spin symmetry. Any of these states can be thought of as the ground state.
The allowed maximal value of $M_S$ is indeed maximized in the ground state. Again, looking at this example, the next highest $\hat{S}^2$ eigenstate would be $S=3/2$, meaning that its maximal $M_S$ value is $3/2<5/2$.
Maximizing $M_S$ is a generally easy way to arrive at the highest $S$ multiplet that can arise from populating given subshells, but apart from that, the highest $M_S$ member does not have any special role compared to any other of the $2S+1$ members of the given spin symmetry.
I stress that I only talked about atoms/molecules neglecting spin-orbit coupling and without external fields. In e.g. transition metal complexes, the $d$ orbitals of the metal ion are split by a "crystal field" of its surroundings, and become non-degenerate. In such cases, one can experience deviations from Hund's rule in cases where some of the orbital energies become so high, that instead lower lying orbitals become doubly populated (see e.g. [Fe(NO$_2$)$_6$]$^{3-}$ in wikipedia).