Exactly, if the production cost was more then the value produced then no one would mine. The spread between production cost and the price represents the inflation rate in gold.
The inflation rate is the increase in the gold supply. The limited, and risk of the, profitability of mining slows down the inflation rate as insufficient incentive to mine harder.