What kinds of techniques or mechanisms, fantastic, magical or scientific, would make it so that an attacking army would take far less losses storming a castle/walled city than it would by standing outside of it and attacking it with siege engines?
A few things that come to mind would be some sort of magic bubble shield that protects against wall breaking siege engines, or maybe super powerful defensive artillery that would allow the defenders to attack and break up an attacking army if they were to simply stand about.
Another thing to note is that it would be acceptable if the cities/castle have reasonably easy ways of gathering/processing food within itself, so that the starvation of the defenders would take quite some time.
Besides that, another idea to toss up could be that it is naturally unsafe to be outside of a castle/city walls for prolonged periods of time, and that an attacking army would then also need to be able to deal of fierce local flora and fauna, or some other thing like the castle is suspended in the middle of the volcano, and the volcano could erupt at any time, wiping out an attacking army, but the castle is designed such to be alright against such a thing.
I digress; what could be good to promote bloody storming over boring, practical, safe sieging?
PS: I rather have it that in this setting, due to the presence of certain things, it is actually more costly in terms of life to siege, and that storming a castle is safer for the average soldier.