How to offer a reviewer to be co-author?
Seconding other comments and answers: surely no one would be offended if you tried to make such an offer...

However, as already noted, if your offer is made prior to final acceptance, it might be misinterpreted, as your trying to clinch acceptance.

And that possibility surely has to be systematically excluded, so a foresightful editor and/or journal would surely not want to set such a precedent. A journal would not want authors to (be able to) solicit reviewers as co-authors, since this would create a conflict-of-interest situation, and cast doubt on the general validity and impartiality of their refereeing process!

That is, while it would be weird and awkward to publicly state such a policy, I would anticipate that the journal/editor would object as a matter of principle, to putting the reviewer on as a co-author.

Sensible reviewers would also understand this situation, for similar reasons, and in advance would expect no reward beyond "job well done". Even the anonymity of the referee should be maintained, as a matter of principle. Thus, we do often find effusive thanks to "the anonymous referee"...