Some mattresses (and older car seat foams e.g. 1960's Jag), often the more expensive ones, will be foamed Latex rubber, so it was probably a flexible urethane foam. Try a Latex glove in fuel. Density varies a lot, even in the different grades cobbled together in a mattress or chair, as will whether it is closed cell or not. So, in general, a mattress foam is probably not the best option for an air filter, but if it works ... . K&N sell some blocks of foam for certain applications (e.g. KN 85-2003) if you want to buy a dedicated filter foam that you can cut down and have a good chance of lasting.
eBay postage is often odd, so it never hurts to ask. Remember that a light and bulky item will normally be calculated on some cubic weight measure, not the dead weight.