2 ways you can do this:
When adding purchases simply make the purchase price 0 for the free items.
Find the average price of the item and use that for the unit price.
For example, if you purchase 10 quantities for a price of $2 each, 10X2 = $20
and get 2 quantities free, then the average cost of each will become 20/12 = $1.66