Death Penalty

The Death Penalty was a feature implemented by the dev team to prevent people using death as a quick, easy way home. Upon death, half of your coins (rounded up) will be dropped. It is possible to return and retrieve them. Your character will also only spawn with 100 health and minimal mana (if the character has any) upon respawn, unless equipped with a Nature's Gift. In which case you will respawn with full health and mana. Now with 1.0.6 natures gift just reduces mana usage so that no longer applies.

It is worth nothing that the death penalty takes half of each type of coin on your character. Thus, a character with 1 gold, 1 silver, and 1 copper will lose all his money when he dies (.5 gold, silver, and copper, rounded up.)

Before Terraria was released, the death penalty was losing all items (this will happen in the Hardcore playmode added in 1.0.5 patch), but the dev team thought that was too much. After that, there was no penalty, next being the current penalty. A good way of avoiding the death penalty is to store all your money in a chest before going into caves or fighting boss monsters. That way, you will lose nothing when dying. Another way of saving money is having a piggy bank in your inventory, which allows you to store and access your money while underground.

Alternately, if you are about to die, you can (if you are quick) open your inventory and click "Save & Quit" at the lower right corner of the screen. There is no penalty to this whatsoever; the Death Penalty only applies if you actually die.

You can also open up your inventory and grab some coins to your cursor before you die. This will cause you to drop the coins from your cursor as you spawn back home and as they were not in your inventory when you died, you will not lose them.

Note - Dying because of an explosion that the player causes will not result in a death penalty. They will respawn with all of their money and Items (minus the explosive used). This is because the explosive is a player thrown comsumable, and treats the death as bding caused by PVP.