Explain this penalty to me.

Sorry if this was posted, but I searched and found none. The Saints got called for an illegal formation early in the 3rd. The ref announces that the saints lined up in an illegal formation then shifted to a legal one. Ok if we move back to a legal formation before the snap, how can it be a penalty?
:interrogations: