I would take Amtrak both ways, booking as soon as you can before the price jumps and/or the trains are sold out, instead of commuter rail, for the following reasons:
As you mention, the total trip each way is about two and a half hours. However, that is if NJT and SEPTA are an immediate connection, which would be rare. It is more likely that you will have a half hour to an hour wait, in Trenton (which is depressing and where there is nothing you would want to do), between trains both ways, so you could end up with six or seven hours of travel instead of sightseeing. it is also possible that NJT will cancel a train or that a train will have a long delay (not that Amtrak is immune, but with NJT it's almost standard procedure).
Also, because Philly makes a really huge deal out of the Fourth, SEPTA may very well be crowded.
If you have only one day to spend in Philadelphia, you don't want to spend half of it commuting. (There is a lot to do and see in Philly--more than people realize sometimes--so you want as much time there as possible.) If you were going to be there several days, that would be different, and commuting might be worth the savings.
You might want to look up what's going on there for the days you're considering, to help you choose which day to go.
And finally, as I always tell everyone, make sure you take a minute to look at the gorgeous main hall in 30th St. station!