rivileges as when acting within their respective cities and towns; and the city or town providing said officers shall be entitled to receive from such city or town the amount paid to them for their service, including their necessary traveling expenses.