When purchased, the value of raw materials are entered into inventory (which appears on your balance sheet). When a product is sold, the part of inventory that was used to create your product is transferred from inventory to cost of goods sold.
Related Questions:
What does Offtoa do with production days and inventory days?
How do I change production days?
How do I change days in inventory?
Where do I enter/change raw materials?