Contrary to popular myth, the income tax and the IRS are constitutional. That's what happens when you have your own constitutional amendment authorizing you. Nobody likes them though, so we should be able to get rid of that amendment.
The 16th Amendment, ratified in 1913, is concise: "The Congress shall have power to lay and collect taxes on incomes, from whatever source derived, without apportionment among the several States, and without regard to any census or enumeration."
According to information on the IRS website, President Lincoln and Congress created an income tax in 1862 to help pay for the Civil War. The income tax was repealed a decade later, then revived n 1894. But the Supreme Court declared it unconstitutional in 1895.
Then came the 16th Amendment. In 1913, the first Form 1040 appeared after Congress levied a 1 percent tax on net personal incomes above $3,000 with a 6 percent surtax on incomes of more than $500,000.
The IRS is part of the federal Department of Treasury.