Section 7. The expense of maintaining the infirmary shall be paid by the several towns interested, in proportion to their share of the state tax at the time when the expense was incurred, unless they agree to a different proportion.