As FumbleFingers points out
This is an old idiom, little used today: according to Google Ngrams it has been declining steadily since the end of the 17th century. You should suspect that a phrase so little used in PDE will have drifted somewhat from its original meaning.
In the passage you cite it does not bear the sense you offer, Merriam-Webster 2.b “depending on whether” (alongside 2.a “depending on how”), but Merriam-Webster 1 “in accord with the way in which”. In fact, OED 1 gives only meanings closely related to M-W 1, but none similar to M-W 2. The A-Ant fascicle of OED 1 was published in 1884; clearly M-W 2 is a 20th-century extension.
The derivation of sense 1. is easy to discern. According as an adverb was from its first appearance in English roughly equivalent to the modern accordingly: it meant ‘in accord / concord / correspondence / agreement (with), consistently (with), correspondingly or proportionally (to)”. As here has one of its common senses—in the dictionary you point to, sense 2:
used to indicate by comparison the way that something happens or is done
Put the two together and you have “in accord with the way in which something happens or is done”—exactly the sense in which Hamilton uses it.
And it is no more difficult to see how the modern sense, “depending on how / whether”, arises out of that meaning. If matter A is required to be in some respect “in accord with” matter B, it is in that respect dependent on matter B. For instance, if we say that “Men are to be rewarded according as they deserve it”, then their rewards are dependent on their deserts.