E. Cobham Brewer 18101897. Dictionary of Phrase and Fable. 1898.
Thirteen for twelve. When a heavy penalty was inflicted for short weight, bakers used to give a surplus number of loaves, called the inbread, to avoid all risk of incurring the fine. The 13th was the vantage loaf.
Mr. Riley (Liber Albus) tells us that the 13th loaf was the extent of the profit allowed to retail dealers, and therefore the vantage loaf means, the loaf allowed for profit.
To give one a bakers dozen, in slang phraseology, is to give him a sound drubbingi.e. all he deserves and one stroke more.