Madison wrote in Federalist 41 that "common defense and general welfare" is a reference to the subsequently enumerated powers:
Nothing is more natural nor common than first to use a general phrase, and then to explain and qualify it by a recital of particulars. But the idea of an enumeration of particulars which neither explain nor qualify the general meaning, and can have no other effect than to confound and mislead, is an absurdity
The Butler decision that overturned this line of thinking said that the "general welfare" language means that "the powers of taxation and appropriation extend only to matters of national, as distinguished from local, welfare". The very next year in Helvering, the court effectively ceded all jurisdiction on this question:
The line must still be drawn between one welfare and another, between particular and general. Where this shall be placed cannot be known through a formula in advance of the event. There is a middle ground or certainly a penumbra in which discretion is at large. The discretion, however, is not confided to the courts. The discretion belongs to Congress, unless the choice is clearly wrong, a display of arbitrary power, not an exercise of judgment.
Madison held that the phrase "to pay the debts and provide ..." merely qualified the Clause 1 power to tax, and that the "provide" language is just a reference to the subsequently enumerated powers. Like the uniformity restriction that concludes Clause 1, the "provide" language is obviously just a restriction on the power to tax. Hamilton wanted the national government to have broader powers, and in fact at the Constitutional Convention the Hamiltonians tried to convert the comma after "excises" to a semicolon, so that the "to provide" infinitive would become a description of an independent Congressional power.
The Supreme Court agreed with Madison for almost a century and half, until Justice Roberts reversed this position in a passing comment in US v. Butler (1936). For my critique of Roberts' fatefully sloppy analysis, see below. The next year, a court coerced by FDR's court-packing threat hand-waved toward the Butler decision in order to uphold the Social Security Act. In that decision (Helvering v. Davis), Cordozo repeated Roberts' earlier pretense that the new interpretation of Clause 1 is too obvious to need actual explanation in a Supreme Court opinion.
The Butler Case
The court decided in passing in 1936 (US v. Butler, by Justice Roberts, http://www.tourolaw.edu/patch/Butler/) that Congress can spend for the general welfare:
They can never accomplish the objects for which they were collected, unless the power to appropriate is as broad as the power to tax.
Obviously false. For example, if the federal government wanted to reduce wine consumption, it could tax wine imports, but use the revenue to help finance e.g. the military.
The necessary implication from the terms of the grant is that the public funds may be appropriated 'to provide for the general welfare of the United States.' These words cannot be meaningless, else they would not have been used. [..]
The reasoning is obviously flawed. If any and all spending for "the general welfare" is already authorized, then much of the rest of Section 8 is redundant. The rest of Section 8 authorizes provision of the postal system, army, navy, and militia -- each of which the framers clearly considered as contributing to "the general welfare".
Here is the core of Roberts' argument:
Since the foundation of the nation, sharp differences of opinion have persisted as to the true interpretation of the phrase. Madison asserted it amounted to no more than a reference to the other powers enumerated in the subsequent clauses of the same section; that, as the United States is a government of limited and enumerated powers, the grant of power to tax and spend for the general national welfare must be confined to the enumerated legislative fields committed to the Congress. In this view the phrase is mere tautology, for taxation and appropriation are or may be necessary incidents of the exercise of any of the enumerated legislative powers. Hamilton, on the other hand, maintained the clause confers a power separate and distinct from those later enumerated is not restricted in meaning by the grant of them, and Congress consequently has a substantive power to tax and to appropriate, limited only by the requirement that it shall be exercised to provide for the general welfare of the United States. Each contention has had the support of those whose views are entitled to weight. This court has noticed the question, but has never found it necessary to decide which is the true construction. Mr. Justice Story, in his Commentaries, espouses the Hamiltonian position. We shall not review the writings of public men and commentators or discuss the legislative practice. Study of all these leads us to conclude that the reading advocated by Mr. Justice Story is the correct one. While, therefore, the power to tax is not unlimited, its confines are set in the clause which confers it, and not in those of section 8 which bestow and define the legislative powers of the Congress. It results that the power of Congress to authorize expenditure of public moneys for public purposes is not limited by the direct grants of legislative power found in the Constitution.
So what is the sum total of Roberts' argument? 1) The general welfare phrase can't be meaningless. 2) Hamilton, Story, and unnamed others argued that it authorizes any spending that one could claim is for the general welfare. 3) The Court has "studied" their arguments, "shall not review" them, but found them "correct".
That's it. That's how the highest court in the land reversed the 147-year assumption that the federal powers of the purse are enumerated in Art. I Sec 8, and decided instead that they are limited only by the ability of politicians to declare expenditures as being for "the general welfare".
Roberts hilariously proceeds to put a fig leaf on his reasoning by pretending it's bold to draw a line against any spending that is not for the "general welfare":
Monroe, an advocate of Hamilton's doctrine, wrote: 'Have Congress a right to raise and appropriate the money to any and to every purpose according to their will and pleasure? They certainly have not.' Story says that if the tax be not proposed for the common defense or general welfare, but for other objects wholly extraneous, it would be wholly indefensible upon constitutional principles. And he makes it clear that the powers of taxation and appropriation extend only to matters of national, as distinguished from local, welfare.
As bad as the above reasoning is, the greater sin is exposed in what follows:
[..] we naturally require a showing that by no reasonable possibility can the challenged legislation fall within the wide range of discretion permitted to the Congress. How great is the extent of that range, when the subject is the promotion of the general welfare of the United States, we need hardly remark. But, despite the breadth of the legislative discretion, our duty to hear and to render judgment remains. If the statute plainly violates the stated principle of the Constitution we must so declare. We are not now required to ascertain the scope of the phrase 'general welfare of the United States' or to determine whether an appropriation in aid of agriculture falls within it. Wholly apart from that question, another principle embedded in our Constitution prohibits the enforcement of the Agricultural adjustment Act. [..]
Here Roberts blatantly violates the sacred principle that the Court should use the narrowest grounds to make its decisions. US v. Butler in fact overturned the Agriculture Adjustment Act on other grounds, and so what Roberts did was throw open the door to "general welfare" socialism merely via obiter dicta (i.e. "an opinion voiced by a judge that has only incidental bearing on the case in question and is therefore not binding.")