Let's affirm that the author(s) is/are responsible for the entire paper. If there are errors in the mathematics or theory, or in the references; or if there are flaws in the presentation (including the organization of the material, the writing quality, etc.), the author(s) is/are responsible (with the exception of errors made in the printing process after the final draft has been approved).
However, I have read several publications that were so flawed that it is clear they were not properly reviewed. If an error appears in the printed paper, the referee(s), or in some cases, the editor who failed to supervise proper reviewing, often must (anonymously) share the blame. A major purpose of the review process is to prevent publication of errors, either by reporting them to the author(s) with suggestions for correction or by rejecting the submission. When I referee a mathematics-based manuscript, I must work through the mathematics of the paper to make sure it's correct. I also must know the literature upon which the submission relies, report any inappropriate citations, and note any citations that should be but are not present. If the paper is ready for publication, I recommend publication; if the paper has worthy results but I find significant ways in which it can be improved, I recommend the authors make the improvements and resubmit; if the paper lacks results that are all of correct, interesting, and original, I recommend rejection. When I am unable to perform these duties, whether for lack of time or due to the core of the paper being outside of my expertise, I decline the invitation to review.