In the particular example of this sentence, it is impossible to know who loved Rani: was it Ram? was it the brother?
The real meaning can be understood only if more information is provided.
Adding a comma will not help either:
I know the brother of Ram, who loved Rani.
It still remains ambiguous.
There is no simple way to fix this sentence to make it unambiguous.
One possibility is:
- I know the brother of Ram. Ram loved Rani.
or:
- I know the brother of Ram. This brother loved Rani.
But if you say:
- I know the brother of Ram. He loved Rani.
then it becomes ambiguous again.
It is the same kind of ambiguity as in the following sentence:
The girl came to her mother laughing.
We cannot know if the girl was laughing or the mother.