Why a function returns an array is much slower than a subroutine returns an array? (real MWE included)

which part is invalid, would you point out please?
I am by no means expert in Fortran but I am willing to learn.