Direct taxes have been legal from the start provided they are apportioned among the states. The penaltax isn't proportioned according to population.

If angels were to govern men, neither external nor internal controls on government would be necessary. In framing a government which is to be administered by men over men, the great difficulty lies in this: you must first enable the government to control the governed; and in the next place oblige it to control itself. - Federalist 51