The calorie figure on a packet appears to be a measurement of that food. It is a calculation, produced by applying fixed conversion factors to the quantities of protein, fat and carbohydrate present.
The figures come from average factors
The system in general use assigns a fixed energy value per gram to each macronutrient, with those values derived from experiments conducted over a century ago.
A laboratory measures how much protein, fat, carbohydrate and fibre a product contains, multiplies each by its factor and sums the result.
Nothing about the specific food is measured energetically. Two products with identical nutrient breakdowns receive identical figures regardless of how differently the body handles them.
The factors already account for incomplete digestion
The original work measured the energy released by burning food and then subtracted what appeared in urine and faeces, producing an average net figure.
That subtraction is why the accepted values are lower than the raw combustion energy of the same materials.
Because the correction is an average, it is accurate across a mixed diet and less accurate for any individual item.
Food structure changes what is actually absorbed
Intact plant cell walls resist digestion, so a proportion of the energy in whole nuts and seeds passes through unabsorbed.
Grinding, cooking and processing disrupt that structure and increase the proportion available, without changing the nutrient analysis the label is based on.
The discrepancy is largest for whole foods with tough matrices and smallest for refined products, where the label figure is closest to reality.
Digestion itself costs energy
Processing a meal requires energy for absorption, transport and storage, and that cost differs by nutrient, being highest for protein.
Label figures describe energy content rather than the net amount available after this cost, so the usable energy from equal-calorie meals differs somewhat by composition.
The effect is modest relative to total intake, but it is real and it is invisible in the labelled number.
Why tolerances are wider than the figures suggest
Regulations in most countries permit a margin of error between the declared value and the measured content, because natural variation in ingredients makes exactness impossible.
A figure printed to the nearest calorie therefore carries a precision the underlying method does not support.
The numbers remain useful for comparing products and tracking rough intake, which is what they were designed for, rather than as exact accounting.