It shall be unlawful for a candidate for office or for nomination thereto whose name appears upon the ballot at any election to give to or purchase for another person, not a member of his or her family, any liquor in or upon any premises licensed by the state for the sale of any such liquor by the drink during the hours that the polls are open on the day of such election.