I have already written on the blog about how to get to Nantucket Island, however recently I learned that you can now get to the Cape Cod (specifically Hyannis, where you can get the ferry to Nantucket) by train. Yes by train! Not to Nantucket, but to Hyannis, MA. Close enough! Boston is not that far from Cape Cod or ferry dock to Nantucket Island from Hyannis, MA.
You got options: fly into Boston airport, Ma and either take the Plymouth Brockton bus, rent a car, hire a town car with driver, and now take the train to Hyannis, MA. The train ride is between South Station and Hyannis, MA according to Boston Globe.
More information, directions, and schedule for riding on the train, CapeFlyer, find them on on twitter @CapeFlyer1 or go to www.CapeFlyer.com. Once you are in Hyannis Port Ma, you can then get on HyLine ferry from Hyannis, MA to Nantucket Island, MA.