Foam is plastic and if you test it by burning it, what happens with tell you a lot. The foam that you get in your packaging is probably a type of foam that when burned with burn easily and char nicely and smell and smoke a lot. The aquarium foam probably will resit the burning but will burn eventually but will burn differently and at a different degree. It should be special type of Foam (plastic) that resist different environmental things that can react with it in your aquarium.
So, No it's not the same.