Suppose I'm writing an article about topic X. During research I come across a related article in which the author has made statement Y and referenced publication Z. For one reason or another, I haven't read Z. Perhaps it is an expensive textbook or I'm just lazy. Can I in my article also make statement Y and reference Z, bypassing the middle author, or is that wrong?
Under some circumstances, citing a source inside another source is acceptable. For example, perhaps the original source is not in a language you can read or not readily available. This page describes the APA method for citing using this style. Here is an example that demonstrates how to do this.
For example, if Allport's work is cited in Nicholson and you did not read Allport's work, list the Nicholson reference in the reference list. In the text, use the following citation:
Allport's diary (as cited in Nicholson, 2003).
I would add the caveat one should always try to view the original document whenever possible. I knew a professor in grad school who was added to a manuscript late in the publication process and his name did not appear in the yearly abstract book, but was only included as an author on the original article. He could tell who did not read his article, but only read the abstract book or cited other people because he was not listed as a coauthor in the work cited. For perspective, I was told this story in 2007 and the article was likely published in the 1980s.
This example was possible because prior to online journals and widespread use of search engines, annual abstract and indexes were published (for this professor's field, the practice continued until the mid-to-late 1990s). As noted in a comment, this would be more difficult with the advent of Google Scholar and other online search tools and their corresponding reference manager tools.
It is wrong as you state it. If you found Y in a publication and want to use it, you need to cite Y.
Whether you cite Z or not is another issue. It is a mistake, and likely wrong, to cite Z directly as if you know what it's complete statement and context is when you haven't actually read it. Perhaps, if you read Z you will find that it doesn't say what you think it "ought" to say based on your reading of Y. If you want to cite something, you should be directly familiar with it, just for your own safety.
If you cite something it is so that your readers can get context for what you say. Therefore, you should know that context yourself. Lazy isn't absolving, and money is just money.
Whether or not you should cite Y I think depends on what the thing you're citing is. If it is the main topic of that work and they came up with it or developed it, you should cite them. If they just mentioned it in passing, maybe in their introduction, I would cite Z as they are the originator of the information you want to quote, Y is just how you found the citation of that information.
Now to tackle the elephant in the room: citing without reading! Let's be honest, we all do it. I'm not saying you should take what is in Y as gospel and cite Z without any other knowledge of it, but if the information is well known in your field and everyone regularly says it and cites Z, and you are in a hurry, I'm sure people do just cite Z.
I'm not saying you should, but it happens.
I would say that you should probably read all those "often cited" background papers in your area at some point, and read them critically. Just because everyone cites it and takes that knowledge as given, doesn't mean you shouldn't assess it carefully and draw your own conclusions. If you think everyone cites it wrong you could write a paper or letter correcting it and then get loads of citations yourself!