As others have pointed out, the rigid foam board is not a good sound deadener at all, it is not acoustically rated and for good reason. Based on my knowledge of acoustics,most of which is empirical (i.e trial and error), some thoughts:
-Don't use foam
-If you can, build open grid work type of benchwork, where the trains run on a plywood/homasote kind of composite. The tabletop as someone else surmised is a major vibrating surface, that amplifies the sound, like a drumhead.
Even if you build a solid table, use homasote or something similar.Drop ceiling tiles, if you can get them cheap enough, (like a friend of mine did when a local home warehouse place had flood damage and they had tiles that were spotted/dirty looking, but perfectly strong, got a lot of them for some ridiculous price, since they would probably have thrown them out) can work. My dad had picked up a bunch a store was throwing out, and I used them on my layout, which was plywood tabletop/tubular track, no roadbed, and it helped a lot.
-Isolate the benchwork from its supports. Rubber feet under the legs will work, carpeting is good. Anything that can transmit vibrations to another surface will cause noise, rubber feet with carpeting over a hardwood surface is great. If you mount the railroad into the walls, Have some rubber material between the edge of the tabletop/frame and the wall (not perfect, the screws will transmit some vibration, but a lot less then screws and the in contact length of the frame/tabletop.
-When putting the track down, don't nail it where the screws/nails get to the tabletop, go only as far as the roadbed or underlying homosote or whatever. When you nail the track into the tabletop, it is transmitting vibrations to the table surface. Glue the homosote to the underlying tabletop, and if you use roadbed glue it to the underlayment, so there are no nails there, then either glue the track to the roadbed (if you use it), or use nails that go only into the roadbed and/or underlayment.
-You can put rubber sound deadening material (available at auto parts stores, it isn't that expensive) under the roadbed or if using homosote only, under the track on top of the homosote. It is usually self stick, so you won't have to do much. If you are going to ballast the tracks, then this may be an option even if you don't use roadbed.
-If your train room has an open ceiling, think about either putting a tile ceiling up, or doing what a friend of mine did, hung up cloth as a kind of ceiling and painted it black. It helps absorb the sound, too versus an open ceiling.
The other thing you can do to deaden the sound is have a white noise generator, like an air conditioner, or an air cleaner, or maybe even a white noise generator, it helps cancel out certain frequencies of sound and may make it a more pleasant experience, if the noise bothers you.
Just my thougts based on my experiences.