They’re identical except for the numbers, although the Service Manual says that early production had different wheelsets: “In initial production the gauge (distance between the wheels) of the 622 and 6220 locomotives differed slightly, but in later production this difference was eliminated and the two locomotives became identical.”
While there is this idea that 027 trains were smaller than the O trains, this was true prewar, and it was true in the later postwar era, but during the heyday of Lionel (and toy trains in general) from the end of WWII through the mid-fifties, there was a great degree of overlap between the two lines, and many of the engines were identical except for the numbers: 2020/671 turbines, 2025/675 so-called “Pacifics,” the 2055/685, 2065/665, and 2046/646 Hudsons were identical except for numbering. In the late '50s ('59?) even the little 2037 2-6-4, a stalwart of 027 sets for years, got the number treatment to became the 637, and into the Super O line it went. Then there were the GPs, which were included in both lines, with the Milwaukee 2338 moving from O in 1955 to 027 the next year.
During this period, most of the freight cars were common to the two lines. Even the original small plastic streamlined pullmans (always thought of as 027 passenger cars), were cataloged in both 0 and 027 outfits from 1948 through 1950.
At the bottom of the 027 line, the outfits did indeed include smaller cars and locomotives, and at the top of the O line were locomotives and cars that were never offered as 027 items (the Berkshires, FMs, aluminum coaches, the 4-truck depressed-center flatcars, the big metal single-dome 2555 and 6555 tank cars of the late '40s, for example). But in the middle of the range, most of the cars were common to both lines: the 6456 hoppers, 6462 gondolas, and, of course, the 6464 boxcars, among many others. Then, by about 1956, the 027 sets began to include an larger number of the smalle