@Polly8 @Branka-and-Silvia0 I use foam mattresses- actually not sold as mattresses, just foam slabs which can be cut to the correct size, the same as I use in my upholstery work. I use a high quality firm foam, 4" thick, with a softer high quality 2" foam on top. Cushy mattress pad over all. For my own bed and the guest bed. Have had many guests comment how comfy the bed is.
I love the foam, because it's light and easy to move by myself. I can even flip them off once in a while to turn the bed frame on its side and vaccum the underneath of it.
I only know this because I use foam all the time in my work- the determining factor in whether foam will hold its shape over time is the "density" of the foam, which is, in fact, the quality. It has to do with how close together the molecules of foam are. My own foam mattress is 11 years old and is not at all out of shape. Foam is essentially a synthetic sponge (as opposed to a natural sea sponge). You know how you can buy a cheap kitchen sponge, use it for a week and it starts to fall apart? Low quality foam. Other sponges, that you'd pay more for, like a big sponge you wash the car with- higher quality foam, lasts a long time.
So what you need to look for with foam is "high density". This has nothing to do with the thickness of the foam or the softness or firmness. You can get a piece of high density foam that is 2" thick, but soft, and it will maintain its "bounce back" factor far longer than a piece of low density foam that is 6" thick and firm. "Memory foam" is simply super high-density, but soft, foam.
A selection of various quality foams in whatever thickness or firmness you want may be difficult or impossible to find, depending on one's location. But the place to look for this isn't a mattress store, but a place that sells supplies to upholsterers, or somewhere that just specializes in foam sales.
One way to check good foam density- press into the foam with your thumbnail, hard. Should immediately bounce back, leaving no imprint. If it leaves a dent, or takes any time to pop back up, poor quality.