Answer not a fool according to his folly,So do we answer the fool or not?
lest you be like him yourself.
Answer a fool according to his folly,
lest he be wise in his own eyes. (Proverbs 26:4-5)
There are a couple responses to be made to this. Firstly, it must be remembered that the book of Proverbs contains proverbs: aphorisms that are generally true. Pointing to isolated cases that don't conform to the rule is hardly proof of their error. That being said, if they are generally true, how can opposite claims both be generally true?
For starters they could be suggestions that are both true in different situations. Situations can differ according to the nature of the folly (refute the facts, don't imitate the demeanour); or the foolish claim (refute some claims not others).
But the biggest clue comes in looking at the larger context. The first 12 verses of chapter 26 (save the second verse) discuss the problem of dealing with fools. Fools are not due honour, do not learn from their mistakes, misuse proverbs, and generally cause problems to all those around them. The problem here is not Solomon's proverb, it is the fool. Because he is a fool no matter how you deal with him everything turns to custard.
There is a somewhat similar type of proverb in English: You are damned if you do and damned if you don't. No one thinks this proverb is nonsense, it basically means the issue is intractable: no matter which course you take it will fail or someone will be unhappy. It is the same problem with the fool. He needs to be rebuked for his foolishness yet even doing that risks that we might imitate him.