To help rare whales, Maine and Massachusetts will spend $27