I have read the Levine Quantum Chemistry book and it says "Hamiltonian operator has no effect on the spin function" in chapter 10 (Electron Spin and the Spin-Statistics Theorem) and does the Hamiltonian operation like the following. Why the g(ms) state is taken out of the Hamiltonian?? Why is it constant with respect to the Hamiltonian?
$$\hat H[\psi(x,y,z)g(m_s)] = g(m_s)\hat H\psi(x,y,z) = E[\psi(x,y,z)g(m_s)]$$