Stray means out of place and alone, which means that the puppy could just be lost (not necessarily that it doesn't have a home). Homeless, on the other hand, means without a home, but not necessarily alone.
Answer: The words are synonyms because they have a similar meaning, but are slightly different.