From the Super Mario Wiki
Donkey Kong series
Donkey Kong Country marks the first appearance of Minecarts. They are used as a mode of transportation in several levels. Skull Carts appear in Donkey Kong Country 2: Diddy's Kong Quest and a sled like cart appears in Donkey Kong Country 3: Dixie Kong's Double Trouble. Donkey Kong Land and Donkey Kong Land 2 offer the mine cart, as well as Donkey Kong 64. Both Kongs and Kremlings use them, and Kremlings known as Krashes would try to attack Kongs from theirs.
They reappear in Donkey Kong Country Returns and Donkey Kong Country Returns 3D in a total of 6 levels: Crazy Cart, Rickety Rails, Grip 'n' Trip, Bombs Away, Prehistoric Path, and Roasting Rails. While the Kongs would normally jump with their minecart, in Rickety Rails, Grip 'n' Trip, and Roasting Rails, the Kongs jump separately from the minecart. In these levels the player must time the jumps correctly so the Kongs land back in the minecart - if they fall off, they will fall through the tracks and lose a life.
Carts make another appearance in Donkey Kong Country: Tropical Freeze, operating much like they did in Donkey Kong Country Returns. However, they can now take up to two hits when the Kongs aren't carrying any Crash Guards, except in Hard Mode, where taking damage even once will cost the player an Extra Life Balloon. Carts only appear at the levels Trunk Twister, Sawmill Thrill, High Tide Ride, and Rocket Rails.
A cart-like vehicle referred to as a lorry appears in the Club Nintendo comic "Mario's Picross". Mario finds the lorry in a pyramid after trying to escape from a Chomp Rock that has been released through a trap door. The plumber jumps into the lorry which immediately begin to move very quickly. Though he can escape from the rock, the rails reach a dead end, making Mario crash through the pyramid's wall.
Super Mario RPG: Legend of the Seven Stars
In Super Mario RPG: Legend of the Seven Stars, the Minecarts are featured in Moleville Mines. The track consists of two parts: a "3D" maze-like course collecting speed-boosting mushrooms, and a "2D" portion collecting coins. The goal is to clear the mines in the fastest time possible. This marks their first appearance as a minigame in the Mario series.
Mario & Luigi: Superstar Saga
In Mario & Luigi: Superstar Saga, another minecart-themed game appears called Mysterious Mine Carts, in which the brothers split up trying to collecting red and green diamonds while avoiding obstacles all at the same time.
Yoshi's Island DS
Cart were introduced to the Yoshi series in the game, Yoshi's Island DS, though the vehicles appeared in only two levels: High-Speed Cart Race and Quit it Already, Tap-Tap!. When a Yoshi gets on a Cart, it rides the track on its own. Yoshi can jump, but with the momentum of the cart he will always land back in it unless he lands on another platform. A cart is seen in a village hut in Spear Guys' Village Found!, but is blocked off by walls.
Super Paper Mario
As a nod to their Super Mario RPG: Legend of the Seven Stars and Mario & Luigi: Superstar Saga appearances, Minecarts are present in Chapter 5-3 of Super Paper Mario. This time they are more alike to a roller coaster than an actual minigame. One of the Minecarts requires the player to flip into 3-D while riding it to move on through the level. According to The InterNed, the music that plays during the minecart ride is "Truck GO".
Paper Mario: Sticker Star
Minecarts appear in Paper Mario: Sticker Star in Bowser's Snow Fort, where they are treated like an amusement ride famous within Shy Guys. These carts are red and have a Shy Guy face marked on the sides. Mario can again jump with them to avoid gaps and collect coins. Some scraps of the rails must be collected via Paperization. The music played while riding minecarts is entitled "Go Go Trolley!", and is a remix of Super Mario 64 theme "Slider".
Super Smash Bros. Brawl
Mario Kart Wii
In Wario's Gold Mine of Mario Kart Wii, Minecarts can be seen going along the mine tracks. They act as obstacles in some parts of the course, and any player who hits them will be knocked away. These minecarts contain gold and have Wario's emblem on the sides.
Captain Toad: Treasure Tracker
Carts reappear in Captain Toad: Treasure Tracker acting similarly to how they appeared in previous games. The player is able to throw turnips from these by aiming with the Wii U GamePad's gyroscope sensor.