Why does my Network shows different speed in a Terminal and in the Browser?

From the speedtest-cli repository:

There is the potential for this tool to report results inconsistent with Speedtest.net. There are several concepts to be aware of that factor into the potential inconsistency:

    1. Speedtest.net has migrated to using pure socket tests instead of HTTP based tests
    2. This application is written in Python
    3. Different versions of Python will execute certain parts of the code faster than others
    4. CPU and Memory capacity and speed will play a large part in inconsistency between Speedtest.net and even other machines on the same network

Issues relating to inconsistencies will be closed as wontfix and without additional reason or context.

So this is a known problem.

Answers to a similar question at SuperUser seem to indicate that more recent versions (i.e. clone the Git repo and buid from there) are better but not yet perfect.