As the case you cited itself said of the municipal tax scheme: "The power of the State to classify according to occupation for the purposes of taxation is broad. Equal protection does not require identity of treatment. It only requires that classification rest on real and not feigned differences, that the distinction have some relevance to the purpose for which the classification is made, and that the different treatments be not so disparate, relative to the difference in classification, as to be wholly arbitrary." Walters v. City of St. Louis, Mo., 347 U.S. 231, 237, 74 S. Ct. 505, 509, 98 L. Ed. 660 (1954). This is an expression of what eventually became known as the rational basis test in equal protection cases and extremely few laws, tax or otherwise, have been struck down on equal protection grounds where the rational basis test is applied. If the distinction made is based on race, sex, or sexual orientation higher standards are applied and such laws face a more rigorous challenge. But those standards are not in play here. So the rational basis test applies to distinctions in deductions that do not involve race, sex, or sexual orientation. See, for example, a fairly recent case in which a professional gambler challenged the difference in tax law in deductions for professional gamblers versus other self-employed persons on equal protection grounds. The U.S. Tax Court rejected the challenge rather easily, stating:
We agree with respondent that the reasoning in our Opinion in Valenti is dispositive of petitioner's equal protection claim. In Valenti, we held that the application of section 165(d) to the net gambling losses of a professional gambler does not violate the gambler's constitutional right to the equal protection of the laws....
The basis for the enactment of section 23(g), as set forth in the last sentence of the foregoing committee report, still pertains to taxpayer reporting of gambling gains and losses. Therefore, it still constitutes a “rational basis” for the continued application of section 165(d) to the losses.
Lakhani v. Commissioner, 142 T.C. 151, 162 (2014), aff'd sub nom. Lakhani v. Commissioner of Internal Revenue, 731 F. App'x 657 (9th Cir. 2018).
The reason that rational basis challenges pretty much always fail is that the courts say that any reason that can be articulated to support the distinction made is good enough; it does not have to be a reason the court agrees with nor does it even have to be a reason Congress or the legislature expressed when passing the law. If the lawyers arguing the case for the government can come up with at least one reason that can explain the reason for the choice made, that's going to be good enough. The courts adopt this approach because to do otherwise would put the courts in the position of being arbiters of which policies the representatives of the people enact are good and which are not, undercutting our democracy in the process as it should be Congress and the legislatures that decide which policies are good and which are not, not the courts.
In short, a taxpayer who is now denied this deduction will not succeed in challenging the change in the law on constitutional grounds. The courts give Congress extremely wide latitude in fashioning tax deductions, often stating that allowance of deductions at all is by "legislative grace."