AFAICT, the "contracts" specified in the act that created Amtrak have long expired and been replaced by new set of regulations. So they are of very little relevance in the discussion at this time. Of course a greater expert in the laws could set me straight on that matter if I err.
So one of the new laws namely Section 207 of PRIIA 2008 is the law that was challenged and the court found that to have reached beyond what it deemed allowable. To get the details of their reasoning read the verdict which has been linked in this thread above. Incidentally it has nothing to do with how much the freights are losing or not. It is a narrow decision having to do with who gets to control how much of the process of definition of standards and enforcement of the same. The issue of whether Amtrak is a private corporation or a government entity came up, and the court decided that for the purposes of this case it is a private corporation. Again, the reasoning can be found in the full text of the verdict.
AFAICT, the "contracts" have
NOT expired. In fact they have been upheld by courts on a surprisingly regular basis. Unless there was a definite expiration date on a bill, they are open ended. The "freight railroads" all still have common carrier obligations under both federal and state laws. As private companies, how else would railroads have eminent domain authority, right-of-way authority, and the authority to circumvent and ignore some federal/state/local laws, rules, and regulations? Those are "perks" given to the railroads in exchange for them having common carrier obligations. When the rails cross public lands, or receive any type of public assistance, they remain obligated. They are
common carriers.
There may be some smaller railroad companies called "contract" carriers, who own all of their own track, do not cross public land, and can accept or refuse any cargo or pax. However, all of the national railroads are "common" carriers.
There was a big to-do about the rules of common carrier rail a few years back, here is a link:
http://www.law.cornell.edu/supremecourt/text/470/451
There was also one a bit later about requiring freight carriers to transport hazardous materials, but I do not recall the exact year.
And in 1984, the Supreme Court clarified and re-stated the fact that "freight" railroads continued to have a common carrier obligation to provide passenger rail service, pursuant to all of the "perks" they received as "common" carriers. They are only relieved of that obligation by contracting/becoming participants in the RPSA.
http://www.justice.gov/osg/briefs/1984/sg840070.txt
https://bulk.resource.org/courts.gov/c/US/470/470.US.451.83-1633.83-1492.html
Remember that the Montrealer train line only became possible due to the common carrier designation given to Amtrak because the CV rail and landowners refused to allow it....Supreme Court again confirmed that "rail" including "freight" railroads, that cross public lands have to abide by "common good" rules, including the OBLIGATIONS of common carriers.
http://www.law.cornell.edu/supremecourt/text/503/407
To sum up, privately owned "freight" rail received tangible subsidies from the "public" (eminent domain, crossing public property, etc.) and as such has obligations to all of the public, and federal/state/local rules say among these is the obligation to provide passenger service. This was too expensive and costly for the companies and they agreed to relinquish that obligation to Amtrak, and give Amtrak priority in return for Amtrak taking that obligation.
Amtrak has kept their end of the agreement, and there is no legal or moral reason that the "freight" rail companies should not live up to their end of the agreement (other than greed)
The current case just decided by the DC circuit only concerned the methods of deciding and enforcing the standards, not the legal status of those standards, in fact, it reiterated the legality of the RPSA.