one way to use it, is an interjection, to emphasise something.
He was by far the tallest boy in his class
It means even the second tallest boy was not nearly as tall. 'by far' means there is a large distance between the subject and an alternative.
That is by far the easiest way to do it.
That is the best way, by far
Where I come from, we also use 'by a long way' as an alternative phrase.