Is there a way to freeze the mob inside a spawner?

I figured it out.

/data merge block (coords) {RequiredPlayerRange:0s}

This does not work with /setblock directly (MC-80690, so either /data merge command still needs to be run after a /setblock command or MaxNearbyEntities needs to be given as well, like this:

/setblock (coords) spawner{RequiredPlayerRange:0s,MaxNearbyEntities:0}