@Viskyar
Base Scenario
You go the store to buy some apples. You have $20. Apples sell for $1 each. You buy 20 apples. $20 for 20 apples, average cost $1/apple.
Variant 1
You go the store to buy some apples. You have $21. Apples sell for $1 each. You buy 20 apples. You have $1 left. $21 - $1 = $20 for 20 apples, average cost $1/apple.
Variant 2
You go the store to buy some apples. You have $20. Apples are on sale, $0.80 each. You buy 25 apples. $20 for 25 apples, average cost $0.75/apple.
Variant 3
You go the store to buy some apples. You have $21. Apples are on sale, $0.80 each. You buy 25 apples. You have $1 left. $21 - $1 = $20 for 25 apples, average cost $0.75/apple.
Variant 4
You go the store to buy some apples. You have $21. Apples sell for $1 each, but with an in-store instant rebate of $0.20 per apple. You buy 20 apples, using $20 and have $1 left, and get a rebate slip for $4. You go to the courtesy counter, hand in your rebate slip, and get $4 back. You get back in line and buy 5 more apples, using $5 and get a rebate slip for $1. You go back to the courtesy counter, hand in your rebate slip, and get $1 back. $21 - $1 = $20 for 25 apples, average cost $0.75/apple.
It doesn't matter the internal mechanics of the transactions. From your point of view, your average is always
(start amount - end amount) / quantity received.