Prof. E. Gadd's time machine
E. Gadd's Time Machine was invented by Professor E. Gadd in Mario & Luigi: Partners in Time. Not much has been explained how it works, other than it is powered by a magnificent gem called the Cobalt Star; and moves through time by opening Time Holes.
During its showcasing at Princess Peach's castle, the princess used it, along with Toadiko and Toadbert to visit the Mushroom Kingdom's distant past. She unfortunately came into the time in which the kingdom was invaded by the Shroobs. The Cobalt Star was then destroyed in order to trap the Elder Princess Shroob, and with a last bit of energy a Junior Shrooboid transported back to the present, wrecking the Time Machine and rendering it useless. The Time Machine's return however temporally opened a Time Hole in the castle garden, allowing Mario and Luigi to step back into the past Mushroom Kingdom. The Time Machine was later re-engineered to run off of the energy illuminating from the numerous Time Holes in the castle, allowing the Mario brothers to safely return to the present. The last use of the Time Machine was by Baby Mario, Baby Luigi, Baby Peach, and the younger Toadsworth in their farewell back to the restored past. As the baby versions of Mario, Luigi, Peach, and Daisy, have since revisited the kingdom in sports and racing games, it maybe that the time machine is still in use.