@SharkAttak A chief failure of the profit motive is that it cares not a whit where profit comes from.
If profit derived only from wealth as defined by Adam Smith ("the produce and labour of the nation"), that would be fine.
But profit is in fact an accounting artefact, not an economic one. That bit of equivocation is at the heart of a great deal of the apparent contradictions and fallacies of mainstream economics.
Profit is based on realised costs and revenues, which means that any trick which can be used to lower or offset / externalise costs, and to inflate or capture revenues, is a net gain to the business.
That's why "free market" entrepreneurs are not in fact in favour of free markets where they can secure higher profits by suppressing free markets. Whether that's through dumping toxic waste (physical or informational), fraud, slavery, labour oppression, tax avoidance, quashing or buying competitors, oppressing suppliers, inserting themselves as middlemen in trade (capturing both supplier and consumer surplus), monopolisation, regulatory capture, lobbying, or any of the other abuses.
Markets can be effective, but generally only where there is a balance of power between capital, labour, government, and common weal generally. If you read Smith closely you'll find that he's a champion of small scale commerce, but casts a jaundiced eye on monopolies (he doesn't use that word, but search for "engross" within Wealth and you'll find some mention), and those who can influence the State to their own interests (wool merchants get a call-out).
As best as I've been able to trace, it, the principles of cost accounting in the US were set out by Alexander Hamilton Church (and yes, related to that A.H.), see: https://en.wikipedia.org/wiki/Alexander_Hamilton_Church.
There's a wonderful inquiry into cost accounting by Leo Tolstoy in, I think in What Is To Be Done, (sometimes "What Then Must We Do") a collection of essays: https://en.wikipedia.org/wiki/What_Is_to_Be_Done%3F_(Tolstoy) https://theanarchistlibrary.org/library/leo-tolstoy-what-is-to-be-done.
@Gotterdammerung
I'm pretty sure @pluralistic is aware of much of this but AHC may be of interest.