Freight railroad companies and unions representing workers have been locked in a dispute over pay and working conditions, but President Biden said Thursday that they had reached a “tentative” deal to avoid a major economic disruption. A strike would have affected not only commuters who rely on the railway to get to work but also the nation’s energy supply and drinking water.