However, it can of course be the case that an essentially good paper becomes published in a journal with low ranking and even in a predatory journal. The background can be bad advice to authors, bad knowledge about journals or that the paper became rejected by established journals by being unconventionaI, not really by being bad. The review process varies also in quality also for good journals.
In a similar way, better ranked journals published sometimes papers which with time are revealing quality problems and even are withdrawn.
Some papers that with time becomes real classics did not at first find any journal that wanted to publish them, an interesting example is Granovetter’s highly influential 1977 paper ”The strenght of weak ties”, with today 49000 citations according to Google Scholar.
The probability to find quality in a better ranked jounal is of course much higher, but my point is that the quality of a paper must not be 100% identified or confused with the status or reputation of the journal.
Amother indicator of quality is the number of citations. In fact, one criteria for reputation of journals is the probability to become well cited when published. individual papers in lower ranked journals can sometimes become much better cited than individual papers in journals with good reputation.
The advice is anyway to research the reputation and profile of possible journals and aim as high as reasonable when chosing which journal to submit a manuscript to.