The city of Boston itself is a railroad hot spot. It has the the nation's first streetcar suburbs and much of the system is in place. The boston "subway" (sometimes it runs above ground) is called the "T." You can get information on the Massachusetts Bay Transit Authority (MBTA) website.
Among the nations oldest railroads are the Boston and Providence, today part of the Northeast Corridor line and served by both Amtrak and MBTA commuter service and the Boston and Lowell, also served by MBTA commuter service. Trains depart from Boston's South Station.
At South Station you can see an Acela which runs between Boston and Washington. This is America's fastest train but does not compare in speed to European trains. It is also the most expensive. The Boston to Providence line is not particularly scenic but does have a lot of old railroad buildings along it. If you want to see it I suggest you take the MBTA commuter train which is cheaper and slower; you will see a lot more.
I've never been to Lowell. It was America's first factory town and today is suppose to be a restored tourist attraction.
There is no rail service to Cape Cod. You can certainly drive there. There are a lot of old towns and at the end Province Town is perhaps the best known place. In November it will be fairly quiet as it is very much a summer resort.
Boston is one of the few US cities where it is quite possible to live without a car. It was an important city during the American Revolution and important during the industrial revolution. The city has many museums and cultural attractions. I don't know what your interests are beyond railroads. There are plenty of current rail operations to see. In addition to what I mention above there is also the Route 128 station on the line to Providence. Route 128 is a ring road around Boston. It is the first commuter railroad station on a large highway in the country but at the same time is not very interesting unless you like dull architecture and large parking lots.
One Amtrak train, the "Down Easter," runs out of Boston's North Station up to Maine.
When you arrive at Logan Airport there is a new transit link to South Station with is a transit hub in the city. Boston is notoriously difficult to drive in. If I were going before I rented a car I would make sure I needed it to get to the particular place I was going and use public transit to get around. However, I don't want to tell you how to take your trip. Most of all I hope you enjoy one of our older cities.
I'm not familiar with freight railroads in the area so I can't comment.