Nineteen people were killed in a massive mudslide that was caused by the collapse of the Fundão dam in the southeast of the nation.
Additionally, it seriously contaminated the Rio Doce River, jeopardizing the route leading to the Atlantic Ocean outlet.
The exact amount that each business must pay was not immediately apparent.
According to Judge Vinicius Cobucci, the corporations were accountable for “moral damages,” or non-material losses like the psychological pain endured by individuals impacted by the occurrence.
He said that the funds would be placed into a state fund and used for projects and initiatives in the area affected by the dam collapse. The funds have been adjusted for inflation since 2015.
State and federal public prosecutors filed a civil action, which prompted the decision.
Vale said to the BBC that it was unaware of the decision as of yet.
The business added that as of December of last year, 34.7 billion reais had been distributed by the Renova Foundation, which the companies have been using to pay compensation.
BBC requests for comments were not immediately answered by BHP or Samarco.
The decision permits the companies to file an appeal.
Samarco is a 50/50 joint venture between Vale of Brazil and BHP, an Australian mining group.
One of the worst environmental disasters in the nation is thought to have occurred in the state of Minas Gerais, which also caused the displacement of 700 people.
Bento Rodrigues village was completely destroyed by a torrent of thick, toxic red mud that was released when the dam burst.