I don’t think Rome had a significant resource advantage over its enemies during the second Punic war. Carthage was very wealthy at that stage, benefitting massively from their conquest in Iberia.
It’s also a mistake to say that Rome inspired significant cohesion and loyalty. The only groups that remained loyal to Rome during the second Punic war were the northern Latin cities. Many cities in the south defected to Hannibal, a lot of the Gallic tribes that had peaceful arrangements with Rome took the opportunity to restart aggressions, Macedonia and many Greek states also took the opportunity to start various conflicts with Rome.
The characteristic of the senate that you could credit to some extent was that they would simply never surrender. That seems to be a very strong Roman cultural value during that period. Rome lost every battle it fought in Italy during the second war. After Cannae they had almost no army, and Hannibal took his army to Rome, and Rome refused to surrender, and Hannibal… left. Because he didn’t have the resources to besiege Rome, and Carthage hadn’t managed (and never did manage) to reinforce him. So he spent a around a decade in control of large areas in southern Italy, unable to fully defeat Rome, and Rome unable to evict him from the peninsula, and with no realistic prospect of ever being able to.
And they never did. Scipio Africanus removed Hannibal from Italy by first conquering Carthaginian Iberia, and then launching a campaign in Africa. This caused Carthage to recall Hannibal home, where he was subsequently defeated by Scipio, ending the war.
It’s also worth noting that Scipio’s campaign in Africa was not properly funded by Rome. His army had a large contingent of volunteers, and the campaign was mostly funded by his private supporters.