There was nowhere as much use of foreign line steam locomotives, compared to the modern age, when diesel-electrics roam the country. Not even close. This is an apples and oranges situation.
And you did not see much off-line use of first generation diesels, either.
The reasons for this are to be found in the shop. Steam locomotives were unique, order by order. Some railroads shared certain components among multiple groups of their steam locomotives, but each railroad's roster of steam locomotives was designed and equipped to that railroad's specifications. Railroad A and Railroad B might use the same type of air pump or feed water heater, but there were multiple types of steam locomotive appliances from multiple suppliers, and the parts supply in a railroad's roundhouses and shops was for that railroad's own locomotives.
Steam locomotives are at the apex of precision, manually-operated machinery. Therefore, they must be operated properly and maintained properly, in addition to being well-designed. A lot of damage can occur from improper operation or maintenance. No railroad would be willing to put its Home Road steam locomotives into long-term use by a foreign line railroad's Engineers and Mechanical Department if there was a future for that locomotive on its Home Road. A good example is the case of nearly-dieselized ATSF leasing some 2-10-4's to PRR in 1956. They might never be the same again after abuse by the foreign railroad. And, don't kid yourself, a railroad would cut corners and spend as little as possible in caring for a foreign line steam locomotive.
In the 1950's and 1960's, there was a limited amount of off-line operation of diesels, but first generation diesels were not always multiple-unit capable with foreign line diesels. Camas Prairie Railroad -- jointly owned by Union Pacific and Northern Pacific -- had special multiple unit jumper cables which had to be used in mixed consists of NP (1 jumper and field loop) and UP (3 jumper and field loop) GP9's. EMD used field loop control for dynamic braking, while Alco-GE used potential line control. Even the assignment of pin numbers in multiple unit receptacles was not standardized, requiring the use of unique 27-pin jumpers when foreign line diesels were m-ued. Those jumper cables were carefully tracked by their owner railroad, to assure that they returned home.
There was a limited amount of regular off-line use of first generation diesels, but it was tightly controlled. An example was the Baltimore & Ohio Royal Blue which ran over the Reading and the Jersey Central with RDG and CNJ crews to Jersey City, using the B&O EMC and EMD passenger units such as EA, E6, E7 and E8. When railroads began freight run-through operation, around 1960, they sometimes modified a group of units for compatibility, but saw that the future was going to require seamless interoperability. So, through the AAR, they developed standards which allow today's locomotives to roam with foreign line units in any multiple unit consist. Labor agreements had to be taken into account because they specified certain requirements for cab appliances (seats, water coolers, etc.) which are necessary in order to allow a foreign line unit to be the controlling unit of a consist. This has resulted in a general upgrading of all locomotive cab interiors and all now are equipped with radios that will function on all the railroad channels..
See Rich Melvin's previous post for a concise explanation of the financial considerations..
So, as far as long-term off-line use of steam locomotives, it was rare. It was a bit less rare with first generation diesels. Only after run-through freight trains became common, did the off-line use of diesels become common.