The phrase is a subtle suggestion that if a treat (like candy) is given, then the child will not perform a “trick" (mischief) on the owner of the house. This popular Halloween custom has its origins in the ancient practices of “souling" and “guising."