I think it depends on what the layout's life will be like. Will it likely be moved? If so, build heavier.
The dimensional lumber frame with foam on top works fine, but sometimes you have to get a little creative finding ways to attach things under the layout (keep a tube of liquid nails handy and have a good hot glue gun).
If you're going with the foam on dimensional route, make sure to include some cross rib support for stability and additional "mounting area" to affix the foam to the wood. Those ribs are also good for hanging hardware from (the numerous terminal blocks under my layout are all generally screwed to mine).