Is the word "end" used in the same way in the following two sentences?

One end of the box was marked 'This side up'.

The ends justify the means.
different meanings