While having the wing spar above the cargo "box" is an advantage of the C-5, it is not a necessary product of the high-wing design. The C-17 has a restrictive height under it wing center-box that imposes some real problems for high loads like helos. Full height end-to-end in the Galaxy!! The only height restriction is for aft loading and that is mostly due to ramp cresting.
The high wing anhedral also caused the engines to be mounted closer in than optimum for wing bending relief. The 747 engines are notablely further outboard and the outers also have greater ground clearance. I think the whole high-wing design was required by the "roll-on, roll-off" cargo requirements. Kneeling landing gear was installed for the loading issue.