The Puritan Samuel Rutherford has a very interesting argument on why James 2 cannot teach that we are justified by works:
How could the Scripture conclude from Abraham's being justified by works, whence he offered his Son [sic] Isaac, unless by works here we understand a working faith, the Apostle must mean the same by works, [James 2] verse 21, that he meant by faith, verse 23, for he cannot say in verse 23 the Scripture was fulfilled (in Abraham' being justified in the work of offering his son, verse 21) which said, Abraham believed God, and it was counted to him for righteousness: Except it must be meant, that the work of offering his son Isaac was counted to him for righteousness. Now the letter of the Text expressively verse 23 saith that believing God was counted to Abraham for righteousness, then the work of offering his son must either be the believing declared by offering his son, and faith working by that act of offering, or if they be two sundry things, he must then say this in effect, Abraham was justified by the work of sacrificing, verse 21, causatively before God, Ergo, the Scripture is fulfilled, verse 23, and Abraham is justified by believing causatively before God, verse 23, which we cannot ascribe to the Apostle, according to their mind who make faith and works the two collateral and joint causes of Justification before God: as if one would say Peter wrought the miracle. So Abraham was justified by works, verse 21. Ergo, Abraham was justified by faith, verse 23.
— Samuel Rutherford, C. Matthew McMahon (Ed.), The Covenant of Life Opened (New Lenox, IL, USA: Puritan Publications, 2005, Original 1654), pp. 239-240
What Rutherford did here was to construct a reductio ad absurdum argument to prove that the justification in James is not the legal justification which Paul talks about. For if that were so, then according to verse 21, Justification would be because of works, while according to verse 23, justification would be because of believing, and this would lead to a contradiction. Since such is the case, the justification in James cannot be a legal justification, but the outward manifestation of true faith in a working faith.