Would it be ethically sound to love a machine that is a perfect replica of a
To get to the conclusion first, I think that the answer is yes, broadly speaking. But I'd like to add a few qualifications.
The first is that I'm not sure the root question is about whether it would be ethically right or wrong. It's more like: would it be some kind of confusion to love this sort of machine in this way? Suppose a child thinks that fancy stuffed animal really has feelings and thoughts, but in fact that's not true at all. The toy seems superficially to have emotions and a mind, but it's really a matter of a few simple preprogrammed, responses of a highly mechanical kind. This might produce strong feelings in the child—feelings that seem like her love for her parents or her siblings or her friends. But (so we're imagining) the feelings are based on a mistake: the toy is just a toy.
On the other hand, if an artificial device (let's call it an android) actually has thoughts and feelings and is able to express them and to respond to what people like us feel or think, then it's hard to see why it would be a confusion to have feelings for the android like the feelings we have to ordinary people. After all, we're supposing that the android has real feelings, possibly including feelings for us.
Put it another way: what you have in mind is an artificial person. The android would be a person because it really has the kinds of psychological characteristics that persons have. It would be an artificial person because it was designed and built rather than born and grown. Whether we'll ever be able to build such things is hard to say. We'd have to understand more than we do now about how matter, organized in the right way, gives rise to minds. But however that works, there's no clear reason to think it couldn't be replicated artificially.
All this said, the relationship between humans with a history of infanthood and childhood, and the looming prospect of old age and death, and, on the other hand, artificial creations with very different origins and prospects wouldn't be psychologically simple. That might have all sorts of implications, moral and otherwise, for what went on between us and them. But the main point is that highly intelligent creatures with complex feelings would deserve our moral consideration even if they were made and not born. And they would also be fit objects for our feelings, quite possibly including feelings of love.
One final note: fiction often does at least as good a job of exploring the issues here as philosophy. And though it's not directly on point, the recent Spike Jonze movie Her raises some interesting questions that you might enjoy pondering.