The only costs relevant to decision-making are what economists call marginal or incremental cost; that's the change in costs as a result of doing something. That cost should be compared to the expected benefit. Think about pollution. Getting rid of pollution is a no-brainer. All that the authorities of, say, Los Angeles would have to do is to mandate that all pollution-emitting sources shut down. That would mean no driving, no manufacturing, no airplanes, no power generation and no lawn mowing. Angelenos would have perfectly clean air, but I doubt whether they'd agree that it's worth the costs. That means perfectly clean air is non-optimal, and so is perfectly dirty air. The question is, how much clean air do we want and at what cost? In other words, we should compare the additional benefit of cleaner air to the additional costs of getting it.
The idea of weighing the costs of doing something against its benefits are part and parcel of intelligent decision-making. If we only look to benefits, we'll do darn near anything because everything has some kind of benefit.