What's the editor's benefit in setting deadlines for manuscript revision? In many journals of my field, upon acceptance of a manuscript for publication with minor revisions, the editor sets a deadline (4 weeks, in many journals) for submission for the revised manuscript.

While I usually resubmit these papers as fast as possible, I don't see the benefit for the editor to set a deadline. After all, once a paper is “almost accepted”, the authors are motivated enough to get it over the final line, aren't they?
Editing a journal is a non-trivial exercise, something which tends to drag on forever and requires lots of pushing of reviewers and authors to complete their tasks on time. It is time-consuming. Without deadlines, reviewers and authors will submit their work arbitrarily late, making it very difficult to get each issue out on time. 

Authors may well be motivated to get over the final line, but when there are other things to do and the possibility of delaying one piece of work yet another day, then it is easy to delay that work.