If judgment is rendered for the plaintiff, the amount of the judgment shall first be credited on any amounts due from the plaintiff under this part, and the balance of the judgment shall be refunded to the plaintiff. In any judgment, interest shall be allowed at the modified adjusted rate per annum established pursuant to Section 6591.5, upon the amount found to have been illegally collected from the date of payment of the amount to the date of allowance of credit on account of the judgment or to a date preceding the date of the refund warrant by not more than 30 days, the date to be determined by the board.