Haribo claimed the Lindt version was a violation of its "Gold Bear" logo.
Germany's Federal Court of Justice ruled Lindt's bear was neither a violation of Haribo's trademark or an imitation of its fruit gum sweets.
Haribo has been making gummy bear sweets since the 1960s.
Lindt introduced its chocolate teddy in 2011.
Haribo took its rival to court in 2012, arguing the products were too similar and it would cause confusion among consumers.
A German court initially ruled in favour of the German manufacturer but an appeal court later threw out the verdict.
Lindt argued that its gold bear was styled on its Easter bunnies, which are wrapped in gold foil with a ribbon and small bell around their necks.
The bunnies were first produced in 1952.
The federal court said in a statement (in German) on Wednesday that Lindt's product could be described using a number of terms such as "teddy" or "chocolate bear" and not just using the term "gold bear".
It said it wanted to avoid the danger of "product design monopolisation" in the area of three-dimensional goods.
In a statement, Lindt welcomed the ruling and said it would "continue to delight all Lindt chocolate lovers with the Lindt Teddy".
Last week, the European Court of Justice rejected Nestle's request to trademark the shape of it four-fingered KitKat bar in the UK.
Swiss chocolate maker Lindt & Spruengli has defeated a legal challenge from rival confectioner Haribo, which sought to stop it making its gold chocolate bears.