Consider the RLC network formed by the mains inductance (~250uH typically), load (much more, ~mH to H for transformers), and whatever capacitance is around (mostly the load, low ~nF for transformers?). The load current at the instant of turn-off, and the mains voltage at the instant of turn-on, sets the initial condition for what follows when the switch changes state.
To dampen either event, an R||L in series (switch closing, dI/dt limiting and current damping), or an R+C in parallel (switch opening, dV/dt limiting and voltage damping) can be used.
And since we're considering the source-load system as its RLC equivalent (for short time scales), the value of R, L and C required to provide this damping are easily derived.

Tim