The House voted Wednesday to allow pharmacists who complete special training to prescribe hormonal birth control as part of a wide-ranging bill, which would also legalize vending machines that dispense over-the-counter medication including an emergency contraceptive.