Depends whether it was "shaft" pit or an "adit/level" pit.
Shaft pits obviously had a vertical shaft from the surface down to the coal seams, so the ponies would drag the drams along underground lines to the shaft bottom, where the drams would be pushed into the cages and lifted to the surface. Those are the mines with the tall steel winding gear above them, typically seen in the Rhondda Valleys.
Adit/level mines have tunnels that are not vertical but go either into the side of a hill or slope down towards the seams. The slopes can be quite steep. Sometimes the ponies might pull the drams out of the mine but if the level was steep often they had a winch to pull them to the surface. Many of the mines in the Forest of Dean are adit/levels.
EDIT.
Drams are what we from South Wales called the wagons. Other regional names may apply.