Cost matter, but the dominate costs are important. The steam engine was more efficient than diesel when they scraped all the steam engines for diesel - steam engines need a lot more labor and so were more expensive despite using less fuel.