It seems that Zacchaeus was going above and beyond the requirement of restitution as stated in Mosaic law by offering to give half of his goods to the poor and to repay fourfold for his theft.
Publicans were hated by the Jews. They were especially despised by the religious Jews as the epitome of sinners and Jewish religious laws prevented devout Jews from keeping company with any of them.
To eat with a publican was unthinkable as the Jews considered this actually partaking of the publican's sins. This is why the people reacted so adversely to Jesus eating with Zacchaeus.
Jesus did not eat at Zacchaeus' house to participate in his sin but to extend mercy and forgiveness to him. This is always the standard we can judge whether or not we should be involved in a certain situation.
We must not participate in other men's sins, but the Lord doesn't want us to retreat to monasteries either. We are the salt of the earth (Matthew 5:13), and to do any good, we have to get out of the "salt shaker." If we can be in control and minister the love of God, then we are right to associate with sinners.
But when we are being controlled by the ungodliness of sinners, we need to take control or withdraw.