I get that. I've avoided it for the same reason. There are DIY foaming kits but the cost per volume of finished foam product is outrageous.
Smaller, or larger? 2x6 here...and every cape cod I've ever seen the framing of (except maybe modular...those may have been 2x4?)
Snow loads in NH being what they are I can't imagine 2x4 rafters in NH even with an extreme pitch roof with short span(s). Unless well engineered trusses.
There are quite a few modular Cape Cod style homes around here and that is in fact what they used for them. I don’t believe they can do it anymore because they can’t get enough insulation in them to meet the new energy code