Thinking too much into it, shim the gaps, end of story. Composite shims are awesome, you can break them exactly where the stand ends and you can barely see them. Pretty sure every one of my tank has shims under it. I don't think putting foam will do enough to distribute weight off the corners, if you think about it the 1/2" thick foam or whatever you buy is not going to compress enough only in the locations that are touching the floor to all of a sudden have your corners all adequately supported, even if the foam compresses into nothing under your tank that only adds a bit of foam support under the corners. Even if the corners start to touch the ground with the plywood they will not have as much support as they would if you shim it with something hard, you are alleviating the problem a bit but not solving it as I think even with the stand on plywood and foam I feel your tank may twist eventually.