keep the foam. With the flattened boxes, you’d still save half the space. The biggest reason to keep the boxes is to be able to safely ship them then or take the pieces with you when you move. But of course, I would not keep the boxes for cheaper items under $500
Any time I ship something and I don't have the box, I double-box it and spend 30 min on making it sure it's safe and I wish I had the original box