The surplus tax (haoxian 耗羨) originated in the custom to levy a surplus on the tax grain in order to cover eventual losses during the transport. It was originally a transport-loss surcharge allowing the tax collectors to deliver exactly the amount of tax grain requested according to the tax quota.
Precursors of this custom can be found in the Tang period 唐 (618-907), during the reign of Emperor Dezong 唐德宗 (r. 779-804). Various regional military commissioners (jiedushi 節度使) used to levy an additional surcharge called xianyu 羨餘 by which they covered the financial needs of the administration of the prefectures under their jurisdiction, filled their own pockets, or presented part of it as "tribute" to the court in order to prove their loyalty and to gain the emperor's favour (yi gu en ze 以固恩澤).
After the Ming dynasty 明 (1368-1644) went over to a regular payment of taxes in money (instead of in kind, i.e. rice), as part of the single-whip method of taxation (yitiaobian fa 一條鞭法), the surplus tax was not abolished, but still levied, and likewise in money. This amount of money was called zhehao 折耗 "converted (i.e. monetized) surplus tax". Part of the surplus tax was used in the local administration for the so-called anti-corruption allowance (yanglian yin 養廉銀), which was part of the income of state officials, and the rest was sent to the provincial treasury (fansi 藩司) under the name "leftovers of the surplus charge" (xianyu 羨餘). In this way the surplus charge was "dedicated to public use" (haoxian guigong 耗羨歸公), even if it did not prevent local officials from embezzling the locally levied surcharge, or levying too much. Even the central government from time to time allowed the levying of various surplus charges because its promise never to raise the basic field tax (tianfu 田賦) brought the provincial governments in financial distress.
There were many other designations for surplus taxes, like jiahao 加耗 "addition to loss", shengdou hao 升斗耗 "volume loss", cangchang hao 倉場耗 "granary-and-barn loss", canghao 倉耗, or quanchang hao 全場耗, queshu hao 雀鼠耗 "sparrow-and-mice loss", shuhao 鼠耗, touzi qian 頭子錢 "head money", guanhao 官耗 "official surcharge", chenghao 稱耗 "scale surcharge", zhenghao 正耗 "standard surcharge", jiaohao 腳耗 "foot surcharge", minghao 明耗, anhao 暗耗, pingyu 平餘, yuping 餘平, etc.
Huohao 火耗 was a special term for the surcharge levied on copper and zinc used for the production of coins, or on silver during the production of silver bars or ingots. During the transport of these metals from southwest China to Beijing, certain amounts were lost by abrasive wear (or theft), and the surcharge made good for the deficits. The huohao surcharge was introduced during the Yuan period 元 (1279-1368). During the Ming period, when silver was the predominant currency, taxes were remitted to the central government in the shape of large silver ingots. These were cast out of smaller silver pieces and crumbs, and the loss of 1 to 2 per cent occurring during the recasting was to be made good for. Yet in fact the tax collectors charged as much as 20 or 30 per cent, during the early Qing period 清 (1644-1911) even up to 50 per cent. In 1724, when a tax reform regularized and standardized tax payment, the "fire loss" surcharge was made a regular tax.