Problem: Jesus claimed that Psalm 41:9 was a prediction of him (Jn. 13:18), but it also depicts the sin of the person in the psalm (v.4). Was Jesus sinful???
Solution: The basis for quoting OT prophecies like this wasn’t to demonstrate a one-to-one prediction. Instead, it was to demonstrate similarities between David and Jesus. In other words, they were merely trying to show the parallels, rather than the particulars. The NT authors were simply trying to demonstrate that there are events in David’s life that are similar to Jesus’ life (e.g. betrayal, being hunted, treated like a criminal, etc.). Thus the problem is in our expectation of predictive prophecy (i.e. being a one-to-one correspondence), rather than the passage itself.