Why is a door prize called a "door prize"?

It's the prize for a contest where the entering is accomplished by walking through the door. In most of these situations, you'd pay a small amount of money to come into a dance or convention, and you'd be given a ticket. At some point the organizers would pull a matching ticket out of a tumbler, and call it out. If no one answered for it, they'd pick a new one. The practice is mentioned as early as 1878.