Passing out treats was established as an alternative to tricks.
We have to thank the candy industry for this sweet tradition!
Back in the 1950s and 1960s, kids usually got coins, toys or home-baked sweets. Besides, they got their treats from certain houses. People were really happy to have candy as a giveaway due to several reasons. It was cheaper than toys, it was easier to buy in bulk and what's even more important - it was premade, so busy moms didn't have to spend a lot of time in the kitchen.
Note from history: On the 31st of October the Celts used to leave some gifts and treats outside their houses in order to ensure the plentiful crops next year.
This might be interesting: Americans buy approximately 600 million pounds of candy for Halloween every year. The infamous Titanic weighed about 100 million pounds and it was one of the largest ships of the time.