The term "to sell down the River" dates back over 150 years. In the antebellum South, slaves in the "Upper South" tended to have a *much* easier lot than field hands in the Deep South, who spent a lifetime working dawn to dusk six days a week. That's why the Mark Twain's character of Jim in Huckleberry Finn fears that his new master might "sell him down the (Mississippi) river".
The term "Going up the river" is just as old, and originated due to the fact that clear back in 1825, the state of New York decided to locate its maximum security prison at the town of Ossining, (or Sing Sing) up the Hudson River from New York City.
Anyone "going up the river" to Sing Sing was going to serve a *very* long sentence.