As @ewcz says in the comments, this is because Shapely only really works with 2D geometry in the XY plane. It is ignoring the Z coordinate here. These are not valid Polygons when projected into the XY plane so Shapely is not prepared to agree that they are equal. It works fine if you remove the (unnecessary) x coordinate:
from shapely.geometry import Polygon
poly1 = Polygon(([220.0, 400, 500], [220.0, 20, 500], [220.0, 20, 0], [220.0, 400, 0], [220.0, 400, 500]))
poly2 = Polygon(([220.0, 20, 500], [220.0, 400, 500], [220.0, 400, 0], [220.0, 20, 0], [220.0, 20, 500]))
print (poly1.equals(poly2)) # False
print poly1.is_valid # False
print poly2.is_valid # False
poly1 = Polygon(([400, 500], [20, 500], [20, 0], [400, 0], [400, 500]))
poly2 = Polygon(([20, 500], [400, 500], [400, 0], [20, 0], [20, 500]))
print (poly1.equals(poly2)) # True
print poly1.is_valid # True
print poly2.is_valid # True
poly1 = Polygon(([220.0, 400], [220.0, 20], [220.0, 20], [220.0, 400], [220.0, 400]))
poly2 = Polygon(([220.0, 20], [220.0, 400], [220.0, 400], [220.0, 20], [220.0, 20]))
print (poly1.equals(poly2)) # False
print poly1.is_valid # False
print poly2.is_valid # False