Ted and Lily drive from the city to Farhampton in *Lily's* car - not Ted's. (actually technically Marshall's since he inherited it from his dad, but jointly owned by Marshall and Lily.) Lily insists on being dropped off at the train station for part of the trip, but Ted drives the car to the Inn.
Barney and Robin come to Farhampton via a limo. Marshall had planned on flying in and presumably Lily would have picked him up from the airport, but had to drive cross country with Daphne instead.
The plan always was for Lily and Ted to remain in Farhampton for an extra day and drive back to the city on Monday (hence why they have to say goodbye to Ted in Farhampton and why they're surprised when they run into him at MacLarens Monday night). Since Ted wanted to go back earlier to pack up to go to Chicago the next day he had to return himself via the train.
Tracy purchased a round-trip train ticket, going from the city to Farhampton on Saturday with plans to stay overnight at Louis's place, perform at the wedding on Sunday, and return to the city Sunday night. Other than checking in at the hotel after she turned down Louis's proposal she stayed with her plan.