Two freehubs
View attachment 962585
On the left, Hyperglide as you have. On the right Hyperglide C which came about when Shimano ripped off Suntour Micro drive and moved to an 11t sprocket.
Notice how the spline stops short of the end on the right one. The splines are closed off on an 11t sprocket, it won't slide all the way onto the hub and interlocks with the shorter spline. As the spline/thread on the older freehub reaches all the way to the end this means the 11t tightens up against the spline end and not against the cassette. Leaving the cassette rattling about by a couple of mm.
Sometimes you can put a spacer behind the cassette to take up the gap but as this shifts the whole cassette over towards the dropout it can, as you've found, hit the frame.
You could fart about spacing the hub out and redishing the wheel or fit a different freehub. The easiest thing to do is use a cassette with a 12t top sprocket as the hub was designed for. It'll go straight on with no problems.