There's typically a gear train that communicates the rotation of the spindle to the threading mechanism. This is so that you can turn a precise number of threads per unit length, and to take multiple passes to reach the desired thread depth. There's a multi-ratio gearbox that sets the thread pitch.
The 2.54 ratio lets you turn metric threads on a US machine, with the help of tables in the manual for how to set all of the levers. Machinists hate it, and these days will prefer to buy a die for the occasional threading job.
The remaining problem is that metric threads are specified by the mm between peaks, whereas US customary threads are specified by threads/inch.
It's not immediately obvious to me (not a machinist) that the 127/50 ratio gets you the ability to cut metric threads without a mess of other head-scratching because you're now dealing with period instead of frequency.
Indeed, the charts for cutting metric threads are complex, and I'm not sure all of the standard pitches are even possible.
The lathe that I use hasn't had its threading gears installed in ages.
A weird historical tidbit is that after WWII a couple of standards emerged for bicycle parts in Europe, where they used metric diameters and inch thread pitches.
The Italian bottom bracket threading standard is completely insane. Like, how do you even cut that, and why would anyone come up with that in preference to literally anything else?
The only thing I can imagine was a supply of American machine tools from the rebuilding of Europe after a WWII. You can always cut any diameter, only the thread pitches are ruled by the capabilities of the lathe.
Also, left handed threads involve their own issues since the spindle chuck wants to unscrew itself.
The 2.54 ratio lets you turn metric threads on a US machine, with the help of tables in the manual for how to set all of the levers. Machinists hate it, and these days will prefer to buy a die for the occasional threading job.