This is an excerpt from John Calvin’s Commentary on Luke 10:28.
Luke 10:28. Do this, and thou shalt live. I have explained a little before, how this promise agrees with freely bestowed justification by faith; for the reason why God justifies us freely is, not that the Law does not point out perfect righteousness, but because we fail in keeping it, and the reason why it is declared to be impossible for us to obtain life by it is, that it is weak through our flesh, (Romans 8:3.).
So then these two statements are perfectly consistent with each other, that the Law teaches how men may obtain righteousness by works, and yet that no man is justified by works, because the fault lies not in the doctrine of the Law, but in men. It was the intention of Christ, in the meantime, to vindicate himself from the calumny which, he knew, was brought against him by the unlearned and ignorant, that he set aside the Law, so far as it is a perpetual rule of righteousness.