Faith is the key.
They kept the laws. Jesus didn’t know them because they didn’t have faith.
Faith is indeed the key. However we know that Faith without works is dead faith. A lawless person is one who does not keep the law...Like the Joel Osteen example...homosexual Christians, fornication Christians, drunkard Christians, etc.
They did not keep the laws of God, which is why they were indicted for lawlessness. The did works, but not the law of God