Typesetting a publication falls under the category of "reproduction", which covers "reproducing a printed page by handwriting, typing or scanning into a computer". This is restricted by copyright law. Typically a journal has the copyright. This does not last forever, the typical duration is the life of the author plus 70 years. In most cases this would limit you to pre-20th century publications.
The circumstance mentioned by the OP that an article is "freely available online" does not by itself change things: what matters is whether the publisher has retained copyright, which they invariably do.
It is difficult to say whether or not the copyright will be enforced if you typeset the article and post it on a web site. I do think arXiv will not allow this, you have to state when you submit a contribution that you own the copyright. Posting on your own web site is unlikely to trigger legal action, I think.
You might object that this state of affairs is bad for "open science", which indeed it is. That motivates the movement away from restrictive copyright, as in Plan S. For older publications this movement will not be helpful.