The Constitutional Court declared legislation allowing members of the executive to conceal sources of funding for campaigns "for positions within political parties" unlawful.
The judgement comes against the backdrop of a fierce leadership contest in the governing African National Congress (ANC) ahead of a conference due in December.
President Cyril Ramaphosa, who is hoping to secure a second term as leader of the deeply factional ANC, is under scrutiny in the lead up to the race.
His previous campaigns highlighted the fight against corruption, but recent scandals including an alleged cover-up of a heist at his luxury farmhouse may undermine his anti-graft credentials.
An independent panel has been appointed to determine if Ramaphosa, the front runner for the top job, could face impeachment
In 2018, the country's ethics watchdog accused him of having misled parliament over a 500,000-rand ($30,000) donation to his 2017 campaign fund from a company facing extensive corruption allegations.
The funds were allegedly used for the hotly contested ANC internal polls that handed Ramaphosa victory, taking over from Jacob Zuma.
In January this year, Ramaphosa came under fire after a recording was leaked where he allegedly made remarks suggesting the use of state funds in an internal election of the ruling party.
"The exclusion from disclosure of donations for internal party elections undermines the Ethics Act and the conflict of interest regime that is essential to promote transparency and to deal with the pervasive corruption bedeviling us," said the court in a judgement.