I'm sure if you put a 30-bar electric fire on the grate, and the electricity heats the air and the hot air flows through the pipes, that would work poorly. But if you either took some water from the boiler and heated it up in the tender (or made long thin electrical heating elements and put them down a few boiler tubes) then the efficiency would go up, since a much higher percentage of the energy ends up in the water.
It is true that extracting a decent percentage of the heat from the flue gases during their notably short passage through the tubes is a major source of inefficiency for a conventional steam locomotive. But I don't think anyone's suggesting just putting a heater where the fire used to be. The Swiss experiment used a great big immersion heater in the boiler, and that is surely the obvious way to do it.
And as has been pointed out, it's still nowhere near good enough.
The most effective "steam battery" technology that has been tried is to use the latent heat of solution/dilution of sodium hydroxide. The boiler has separate sections for water/steam and NaOH. After the steam has passed through the cylinders, instead of being exhausted it is led into the NaOH tank, where it interacts with the NaOH to release more heat to raise more steam. To reset the system you squirt hot dry steam through it, from an external source heated by anything you want, same as an ordinary "fireless" locomotive but with greater range.
This has a range of several miles, so it
might be usable by the shorter steam railways by converting some of the locos from classes of which a disproportionately large number have been preserved. Might. But with no steam chuffing out, it kind of ruins the whole thing, so probably not.
That's not necessarily going to be true forever. Biomass is becoming a very popular option for power generation, and increasing the energy efficiency of fuel there will help the business case for more biomass units.
Don't be misled by the propaganda emitted by those crusty stains at Drax and their ilk. Biomass is a
stupid option for power generation. Obtaining it from trees grown in remote areas half way round the world means the tree end operates pretty much entirely without supervision or enforcement, so the "sustainability" can be faked with outright lies and with vapourware promises for what they'll do in 20 years' time which they can then deliberately go bust to get out of, before restarting under a different name. They don't even have to try very hard, because everyone knows that plants grow themselves therefore they "must" be sustainable, and next to nobody thinks any further about it. And that's without considering the lugging of it half way round the world in ships burning fossil fuel. It's not "green", it's just (rather too effectively) green
washed.
(The short-term liquid-fuel version doesn't work either, because it barely covers the energy used to farm it and we need the land for growing food instead.)
The problem, as ever, is basically down to
stupid politicians who can't understand that allowing a
negligibly small amount of coal mining to run a few old steam engines is indistinguishable for all practical purposes from allowing
none whatsoever as their ill-considered obsessions dictate, and need to spend some time sitting in the room with the guys with rubber hoses until they cease to dispute this obvious point. I and others on here have pointed out that a small-scale coal mine itself would have "heritage tourist attraction" value in the same way as the railways it would be supplying do, and the two operations could operate in collaboration; we still
at present have enough remaining knowledge and enthusiasm to start it up and teach people how to carry it on, if only the politicians would allow it to happen.