From A Wiki of Ice and Fire
Castamere begun as a mine like Casterly Rock, and the Reynes had become near as rich as the Lannisters during the Age of Heroes due to the large supply of gold, silver and gems in the mines. To protect their mine, they had raised a curtain wall to guard the entrance with two stout towers on both sides to defend the approach. Over time as the gold and silver dried up, the mine had been widened and converted into Halls, galleries and bed chambers and even a vast underground ballroom. To the naked eye Castamere seemed a modest holding, fit for only a small Lord or a Landed Knight, the truth however was that nine tenths of the castle was beneath ground. 
Following the failed Reyne-Tarbeck Rebellion, Tywin Lannister extinguished proud House Reyne and shattered their castle above ground, while diverting a river to flood the underground chambers of Castamere and drowning those he trapped inside. The fate of the Reynes and Castamere is remembered in the song "The Rains of Castamere".