What is the difference between opam pin and opam install, when to use one vs the other?

I thought pin was useful for this:

if you want to ensure that your project uses the same version of a package across different development environments.

is it not?

I am seeing some code that pings a package e.g. with

    command = (['opam', 'pin', '-y']
               + root_option()
               + ['--switch', switch]
               + [coq_package, coq_package_pin])

and then tries to reinstall it with:

command: list = ['opam', 
'reinstall', 
root_option(), 
'--yes', 
'--switch',
 switch,
 '--keep-build-dir', 
coq_project]

is the pin really needed for the opam re-install to work? What might be the rationale to do such a pin before the opam reinstall?

In addition I am also installing some packages with make & wondering if that is needed.

command: list = ['make', '-C', coq_proj_path]