Prices sometimes erase that data, when neoclassical economic rents are high. Which can be because the thing in question is just an item of speculative value, or it could be because of market asymmetries.
Otherwise, in a free market with many buyers and sellers, the economic profit of a given commodity will tend towards zero. And that means that it offers a very close approximation of the minimum possible incentive for people to produce that commodity. And incenting people to undertake the production process is part of the true cost of production, as all other forms of human effort and risk-taking are.
If we're just talking about prices as a singular aggregate number, then they erase vast amounts of data, whether they converge on cost or not. What it took to produce something isn't 34 currency. It took 2 hours of labor mill worker time, 3 hours of truck driver time, 6kg lumber, 6 minutes of oil refining, 3L diesel fuel, etc etc etc. Those are actual costs...and even those are still aggregate, but as separate buckets at least. The beauty of information like this is you can price things at PoS based on known information...how harmful are fossil fuels when used at-scale in production? Very? Ok, create a democratically-imposed pigouvian tax on them. Try doing that in a state where people have to claw over each other's backs just to make ends meet and the government is in the pocket of the oil industry.
But yeah, if you just want to know what something costs in currency, then yes, I agree that price converges over time to cost in competitive markets. This is exactly what Marx argued, yet everyone screams about him being wrong for some reason. It's one thing he got right.
Otherwise, in a free market with many buyers and sellers, the economic profit of a given commodity will tend towards zero. And that means that it offers a very close approximation of the minimum possible incentive for people to produce that commodity. And incenting people to undertake the production process is part of the true cost of production, as all other forms of human effort and risk-taking are.