When did the end of a baseball game start to be based on a 9-inning score?

The end of a baseball game start to be based on a 9-inning score in 1857.

The rules were changed to determine the winner of a game as the team that was ahead at the end of nine innings. Prior to the rule change, the winner was determined as the first team to reach twenty-one runs.