They are the fruit which are poisonous so do not eat them but remove and throw away.
Potatoes and tomatoes and deadly nightshade are all of the same family (Solanaceae) and their green parts are toxic. Also they both are subject to blight. Even a potato tuber exposed to the sunlight is toxic, which is why we are warned not to eat greened potatoes. The sun develops the alkaloids which are poisonous. Curiously tomatoes, even green ones are not poisonous. But don't be tempted, like some have, to garnish them with tomato leaf, or you will have a very sore stomach.
If you want your potato tubers to grow the advice is to remove the potato "apples" and so encourage root development.
ps. Something is eating your potato leaves
All the Solanaceae family (potato) have small tomato like fruits after the flowers but nearly all except tomato and eggplants are poisonous and as is the foliage.
oops lol started typing this ages ago just before malagrowther added theirs :)
You know your Solanaceae TOTP!
Thank you for your advice.
I'm happy to get an important information from you saying the "fruits" are poisonous.
I'll throw them away soon.