I ran Boston in 2022. I stayed at Hotel Commonwealth. The hotel itself was excellent, but expensive. It at mile 25, which was great for my family to watch the race out of the hotel window, but it's a solid 1 mile from the finish.
It was a very quick and free subway ride to the start. But since it's a mile from the finish, me and my family had to take an uber back to the hotel which wasn't ideal, since the city is insanely crowded race day, with the marathon and always a Boston Red Sox game.
If I had to do it over again, I'd stay as close to the finish as possible. Those hotels are expensive though, and they sell out fast, usually the day registration notices go out, or sooner. Book now, cancel later if needed.
Not many people stay near the start. I'm not very familiar with Hopkinton, but most of what I saw around there is residential. I'm not sure where the hotels are, if any. I'm sure you could rent an air bnb or VRBO. But then you've got to get back out there at the finish when you'll be dehydrated and exhausted. The advantage is, you wouldn't have to spend so much time standing, waiting for buses race morning and spending so much time on the bus before the race.
The general consensus is, if you've got the money, stay as close to the finish as possible, and take the buses to the start line, when you're fresh and rested in the morning. There are hundreds of them running every few minutes. Then where you're tired at the finish, a short walk to your hotel. I tend to agree, staying at the finish is better than staying at the start. Neither are ideal, when you have a point to point course.