If you want to optimize this with software you can apparently get machine-readable topology of the system via
https://www.mta.info/developers
and write your own graph traversal pessimizer for it. (Easier for stops/graph diameter maximization rather than physical distance, which I don't think is included in this particular dataset.)
https://www.youtube.com/playlist?list=PLB7ZcpBcwdC4ZwbTbCqIC...
74 stations, 41.42 miles, 3:23, 4 boroughs, $3.00 fare Starting from Pelham Bay Park on the 6
(I calculated the shortest one that includes all lines back in the early 2000s but they've obviously changed things around since then.)
Alternately, you can listen to a Billy Joel parody that describes the problem in decidedly less academic terms: https://www.youtube.com/watch?v=a3ww0gwEszo
But I also just followed it for the first time from beginning to end, not doing anything. Because I assumed someone had already done the math.