A fairly common problem with surplus Mauser's is caused by wear of parts or replacement of parts.
In this case, the probable problem is worn or replaced cocking piece or sear "box".
In these Mauser's if the cocking piece, (the plunger at the rear of the bolt) or the actual sear in the trigger assembly is worn or has been replaced with parts that don't fit correctly, the safety may be hard or impossible to apply, and the action may not stay cocked if the safety is turned off.
What's happening is that the worn or replaced parts are allowing the cocking piece to sit too far forward.
Since the safety has to pass between the cocking piece and the bolt shroud, if the cocking piece is too far forward, the safety can't fit between or may be very hard to apply.
With the assembly too far forward, when the safety is turned off, the firing pin sometimes falls.
Look at the safety as you attempt to turn it on safe.
As the safety starts to turn, the cam area on it will move between the front of the cocking piece and the bolt shroud.
If the assembly is worn or mis-fit, the safety will touch the top of the cocking piece and can't force it back enough to go on safe.
Here's an exploded view of a Mauser. This is a commercial 98 model, but the actions are very similar:
The "plunger" or cocking piece is part number 1.
The safety is part number 2.
The bolt shroud is part number 3.
The sear or sear "box" is part number 20.
You probable problem is a worn or misfit of the cocking piece or sear box or both.