Huck gave Judge Thatcher his money because he knew Pap Finn was coming to see him, and Pap would want all of Huck's money for buying drinks. Huck's life would be miserable and all the money would be wasted anyway.