In hospitals? The honest answer is they often don't know the true costs. They'll know the costs specific to a department, but the "shared" costs of the hospital, staff (who work across departments), etc are a major shit show.
That's not to say they can't find out, but it's not easy and frankly they don't do it because they don't have to.