They are enormously labor intensive.
Maintaining a boiler is not something done easily, quickly or inexpensively.
Reciprocating parts (pistons, rods, cranks valve gear) must handle great forces and are not easily kept clean or sufficiently lubricated to prevent wear.
Boiler water of the quality needed to steam properly and prevent corrosion and fouling of the system is not readily available nationwide. Railroads had extensive water treatment facilities and in some cases transported boiler water hundreds of miles to provide fill points along their routes.
Finally, thermal (read fuel) efficiency of steam locomotives (that being what I'm most familiar with) was approx. 6% at the coupler on the latest and most advanced models, versus 20+% on the earliest diesel-electrics, to provide a contemporaneous comparison.
I am a rail fan and absolutely love steam, but there is no economical way that they could compete with the more efficient diesel-electric.