Its in the wording.
“Works have nothing to do with salvation” is meant by us that believers do not merit the attainment of eternal life itself, that eternal life is not a reward to their good works and merits. (Trent, Chapter XVI; The Sixth Session Decree on justification, 1547) - with merit being understood as deserved - but that God-given faith is counted for righteousness, although it must be a manner of faith that results in works of faith, by the Spirit. (Jn. 10:27,28; Heb. 5:9) And which confessional type faith (Rm. 10:10:9,10) God sees and washes, sanctifies and justifies man. (1Cor. 6:11; Acts 2:38; 10:43-4; 15:7-9; Eph. 1:13) To the glory of God.
Faith alone but not a faith that is alone, but not works which merit eternal life.
To me, the works are indicators that the faith is not mere intellectual assent, but genuine faith.
Even the demons believe and tremble.
However, to expect those works to save you or contribute to your salvation, is in error.
There’s a distinction that I think that Catholics miss. That is that there are two kinds of works.
One is the kind that flow naturally out of a person as a result of the faith they have and Christ living in them.
The other is the kind that someone else sets up and demands that everyone else adhere to in order to qualify for salvation.