In medieval times, a baker who shorted a customer was put in jail in
order to think about past transgressions.

As a result, bakers started placing thirteen items (e.g., buns) in a
dozen, hence the term "baker's dozen."