9 Speed Cassette does not go all the way in on the free-hub body Wheel: Shimano WH-R500
Cassette: Shimano CS-HG400-9 9 Speed

I can put the cassette on the free-hub body but the chain will stuck on the highest gear. The cassette seems to not go all the way in on the free-hub body, see the gap between the spokes and cassette.

What did I wrong?
If all the cassette sprockets fit on the free-hub body and you can install and tighten the lockring then all should be good.

You should be able to see from the non drive side that the cassette spider is sitting at the base of the free-hub body grooves.

Note that some cassettes come with a spacer ring that sits behind the cassette spider.