As mentioned by @MT0 using zoneinfo works correctly:
>>> dt(2024, 1, 1, 7, 40, 0, tzinfo=pytz.timezone('America/New_York')).isoformat()
'2024-01-01T07:40:00-04:56'
>>> dt(2024, 1, 1, 7, 40, 0, tzinfo=zoneinfo.ZoneInfo('America/New_York')).isoformat()
'2024-01-01T07:40:00-05:00'
>>> dt(2024, 10, 10, 7, 40, 0, tzinfo=zoneinfo.ZoneInfo('America/New_York')).isoformat()
'2024-10-10T07:40:00-04:00'
In January, NY observes winter time, which is UTC-5, and therefore the offset is correct. If you want to see the -04:00 offset, change date to one where DST is observed, like Oct 10.