There are three main theories for why a baker’s dozen is 13 instead of 12, but most think it has its origins in the fact that many societies throughout history have had extremely strict laws concerning baker’s wares, due to the fact that it is fairly easy for bakers to cheat patrons and sell them less than what they think they are getting.
These societies took this very seriously as bread was a primary food source for many people. For example, in ancient Egypt, should a baker be found to cheat someone, they would have their ear nailed to the door of their bakery. In Babylon, if a baker was found to have sold a “light loaf” to someone, the baker would have his hand chopped off.
Another example was in Britain in the mid-13th century with the establishment of the Assize of Bread and Ale statute, which was in effect all the way up to the 19th century before being repealed by the Statute Law Revision Act of 1863. The Assize of Bread and Ale statute set the price of ale and what weight a farthing loaf of bread should be. Specifically it stated:
By the consent of the whole realm of England, the measure of the king was made; that is to say: that an English penny, called a sterling round, and without any clipping, shall weigh thirty-two wheat corns in the midst of the ear, and twenty-pence do make an ounce, and twelve ounces one pound, and eight pounds do make a gallon of wine, and eight gallons of wine do make a London bushel, which is the eighth part of a quarter.
So basically, in terms of bread, setting the relationship between the price of wheat and what the subsequent price of a loaf of bread from a certain quantity of wheat should be.
Even though this statute was enacted at the request of bakers, it still posed a problem for them. If they happened to accidentally cheat a customer by giving them less than what they were supposed to as outlined by the statute, they were subject to extremely severe fines and punishment, which varied depending on where the lawbreaker lived, but could include, like the Babylonians’ punishment, losing a hand.
As it wasn’t that hard to accidentally cheat a customer, given making a loaf of bread with exacting attributes is nearly impossible by hand without modern day tools, bakers began giving more than what the statute outlined to make sure they went over and never under. Specifically, in terms of the “baker’s dozen”, if a vendor or other customer were to order a dozen or several dozen loaves of bread from a baker, the baker would give them 13 for every dozen they ordered. Likewise, when selling quantities of anything, they’d give 13 measures when only 12 were purchased.
This practice eventually made its way into the Worshipful Company of Bakers (London) guild code. This guild was actually started in the 12th century and had a large part in formulating the rules on the Assize of Bread and Ale statute.
Though the above is generally thought to be the correct origins for a baker’s dozen, there are two alternate theories put forth that are somewhat plausible, though lacking in hard historical evidence and visible progression. The first is that bakers would sell 13 loaves to vendors, while only charging them for 12 which allowed the vendor to then sell all 13 at full price; thus, they’d earn a 7.7% profit per loaf. So in this case, vendors were being given a sort of wholesale price, but without breaking the laws outlined in the Assize of Bread and Ale which had no exceptions for allowing a cheaper price to vendors. This theory has some holes in it, but is quite plausible on the whole.
Yet another theory is that it was simply a product of the way bakers bake bread. Baking trays tend to have a 3:2 aspect ratio. Then the most efficient two-dimensional arrangement of loaves/biscuits/whatever on such a tray results in 13 items with a 4+5+4 hexagonal arrangement, which avoids corners. It was important to avoid the corners, because the corners of a baking tray will heat up and cool off faster than the edges and the interior, which would result in not cooking anything on the corner evenly with the rest. This theory doesn’t explain why they’d sell them in batches 13 for the price of 12, but at least explains why they may have commonly made them in batches of 13 in the first place and is still a possible source, or at least contributor, to the “baker’s dozen” if it was fairly universal that baker’s baked things in groups of 13, as is suggested by the theory.