Te searchlight is mounted on ball mounts, similar to a trailer hitch, that are attached to the mantlet, not the gun itself. The light elevates with the gun as the mantlet raises and falls when the gun controls are used to move it. There is a space between the gun tube and the searchlight.
You can see the mounting balls on this old M48A3 on display in Vietnam
Here is one mounting a search light. You can see the space clearly.