This Washington Post article gives an excellent overview of what to expect for summer food during your Maine vacation or to cook when you're away: Summer Can Be a Maine Event, and this one from Fodors: Summer Eating, will stear you to some of the best summer eats in Massachusetts and Maine.
Having just returned from a trip to our coastal cottage I feel justified in adding to these article.
Corn on the cob: buy it at any local farm stand. My favorite: Five Islands Farm, Georgetown, Maine - though not a local farm, the owner gets the best of the best each day she's open.
Wild Maine blueberries: sold on roadsides and at farm stands. If you are lucky like us, you may find ripe berries on the property of your vacation rental. In good years you can make a simple cobbler, but we rarely get past eating them fresh. Pick up some blueberry jam while in Maine as well.
Raspberries: ditto above!
Maine Lobster: get this delicacy on the water! Follow signs to local co-ops or to old faithful establishments. We prefer our lobsters at home, purchased off the boat from friends and neigbors. You can pick them up at most restaurants that steam them for you, or at any local grocery or fish mart.
As for the best places to eat in Massachusetts and Maine, besides in my beloved Georgetown...Fodors gets it just right.
I waited 40 minutes happily for clam stips at the Clam Box in Ipswich (I know that's not really clams...); made a road trip every summer of my youth to Woodman's in Essex for fried scallops and a trip to Crane's or Good Harbor beaches; and started my love affair with Maine by taking trips over the bridge from NH with my future husband in the 80's to Chauncy's Creek in Kittery for his favorite lobster in the rough. The best whoopie pies however, come from by own kitchen at the hands of my daughters! Maybe some day you'll get lucky and they'll sell them...