Although you arrive early in Machu Picchu on the last day, you will only take the train back to Cusco at the end of the day (between 3 PM and 7 PM). We choose this option because it is by far the most affordable, allowing us to keep the price reasonable. You will arrive back at your hotel in Cusco between 7 PM and 11 PM.
On the last day, you have plenty of time in the afternoon to enjoy the local restaurants in Aguas Calientes or even visit the thermal baths. If you prefer to take an earlier train back to Cusco, you can usually exchange your ticket on-site at the Aguas Calientes train station for an earlier departure, often for an additional fee.