If my understanding is correct, in a lot of Lamentations of the Flame Princess campaigns, if a PC dies, the player has to roll up a new one at Level 1 with 0 XP. There isn't anything necessarily wrong with that, but I just thought of another possible idea that might also be fun.
When a PC dies, the player rolls a d100. The result is the percentage of their dead character's XP that their new character gets to start with. I would personally round up if the resulting XP isn't a whole number, but it wouldn't matter much.
Even if a player only gets to keep 1% of their XP for their new character, that's still more than nothing (unless their last character died at 0 XP). If they get to keep 100% of it, hey, it's that player's lucky day! Most likely, it'll be somewhere in between, which means there will still be a penalty for dying, but not quite as harsh of one as losing all XP. There's also the added benefit of gambling for something important, which is often exciting in RPGs.