Two numbers, two questions
Per-portion cost estimates how much of each pack a meal uses. Top-up cost estimates the cash needed today after accounting for food already at home.
A pasta meal may use less than a pound's worth of ingredients but still require several full packs when the cupboard is empty. Both figures can be correct.
Cupboard items still count as food used
Marking rice, oil and spices as already at home removes them from today's list; it does not make their value disappear. The recipe still uses a share of food bought previously.
Keep quantities reasonably accurate so the estimate remains useful without requiring perfect stock control.
First shop of the month often looks expensive - many full packs bought once.
Later weeks look cheaper as top-up lists shrink.
Planning several meals on the same pack spreads that pack across more portions.
Why the cupboard changes today's total
If rice, oil and spices are already at home, the top-up shop may only include vegetables and protein. The recipe has not become cheaper in value; you are simply using stock purchased earlier. Conversely, the first week after an empty-cupboard shop can look unusually expensive because several full packs are being bought at once.
Leftovers from those packs should be recorded where useful so the following plan can use them. This keeps the checkout estimate honest without pretending that cupboard food was free.
The two figures therefore answer different questions, and seeing both prevents a useful comparison price from being mistaken for the cash needed at the till.