Yes. The Distributor and the Publisher can be on the same machine.
Yes the Distributor and subscriber can be on the same machine but only for one subscriber. Unless you are republishing several times.
In fact you can have the Publisher, Distributor and Subscriber all be on the same machine (I have done this in the lab).
The question is why you would want to do this (Pub, Dist, & Sub on same box). I can envision doing this in lab, or where for some reason I need to replicate part of a database to another database on the same server.
Scenarios for Dist & sub being on the same box. You have only one subscriber, perhaps a reporting server and you don't want to tax the publisher (your oltp database sever) with the work of distribution.
If you are going to have multiple subscribers it is higly recommended to have a separate distributor. This is especially important because the distributor is the first thing configured when doing replication.
DL
MCDBA, MCSD, MCT, etc.