The Commonwealth of Pennsylvania has over 5,900 miles of railroad tracks that criss-cross the state. Over half are owned by Class I railroads, which operate throughout the United States and Canada, and which operate the "major rail lines," or main line routes, shown on the map above. Three different Class I railroads own track and other facilities that operate in Pennsylvania: Amtrak (AMTK), CSX Transportation (CSXT) and Norfolk Southern (NSRR).
Amtrak, officially the National Railroad Passenger Corporation, is the only operator of intercity passenger trains in Pennsylvania. A separate page here in PA Maps shows details of the Amtrak routes and stations. Many of Amtrak's trains operate on track owned by the other Class I railroads.
The rest of the Class I railroads are freight railroads, hauling everything from automobiles and farm equipment to raw materials such as coal. Freight railroads are among the largest movers of commercial goods in the US, though they haul far less than trucks these days. The advantage that trucks have is the flexibility to travel almost anywhere connected by roads. The advantage that will always favor railroads is that they cost far less per unit of weight or volume; they are restricted by their confinement to these existing railroad lines.
The optional map layer of "secondary rail lines" includes branch line operations of the Class I railroads as well as the principal operations of smaller regional or local "Class II" rail companies. As with the Class I railroads, most of the Class II operations are freight haulers, but some are passenger railroads. Some of the latter are tourist rail operations.
Historically, when nearly all industrial production and a vastly larger share of the US population were concentrated in cities, rail transportation was the dominant form of freight transportation. For example, trains moved most of the goods that helped to open up the western US to settlement in the late 1800s and the first couple of decades of the 1900s. It was not until we had effective highways, powerful diesel engines and sufficient gasoline stations, all starting in the 1930s, that trucks could begin to compete with railroads.