Rob Dunn explains why in an illuminating essay at Scientific American. He writes that:
Fat, it has been estimated, has nine calories per gram, whereas carbohydrates and proteins have just four; fiber is sometimes counted separately and gets awarded a piddling two. Every box of every food you have ever bought is labeled based on these estimates; too bad then that they are so often wrong.According to Dunn there are lots of other factors involved in determining how many calories we derive from a portion of food. Everything from the length of our intestines to the kind of microbes we have in our intestines to whether we're lactose intolerant to how long we cook and grind up our food all determine how many calories we harvest from it. Dunn's article is interesting, especially so for those concerned about diet and nutrition.
Estimates of the number of calories in different kinds of foods measure the average number of calories we could get from those foods based only on the proportions of fat, carbohydrates, protein and sometimes fiber they contain (In essence, calories ingested minus calories egested). A variety of standard systems exist, all of which derive from the original developed by Wilbur Atwater more than a hundred years ago. They are all systems of averages. No food is average.
Differences exist even within a given kind of food. Take, for example, cooked vegetables. Cell walls in some plants are tougher to break down than those in others; nature, of course, varies in everything. If the plant material we eat has more of its cell walls broken down we can get more of the calories from the goodies inside. In some plants, cooking ruptures most cell walls; in others, such as cassava, cell walls hold strong and hoard their precious calories in such a way that many of them pass through our bodies intact.
It is not just cooked vegetables though. Nuts flagrantly do their own thing, which might be expected given that nuts are really seeds whose mothers are invested in having them escape digestion. Peanuts, pistachios and almonds all seem to be less completely digested than their levels of protein, fat, carbohydrates and fiber would suggest. How much? Just this month, a new study by Janet Novotny and colleagues at the USDA found that when the “average” person eats almonds she receives just 128 calories per serving rather than the 170 calories “on the label.”