Yes, it looks like black nightshade, but you should be careful when using inductive logic with plants. Just because it looks like something doesn't necessarily mean that's what it is.
From what I've read, black nightshade can be edible when ripe, but not all kinds of it are.
If you want a cultivated plant that looks very similar to your plant there (and is related to it), you should try planting wonderberries. Luther Burbank (a well-known plant breeder) spent maybe 25 years breeding them; so, you can be sure they're edible (when ripe). I grow them. They're very easy to grow. Just grow them like tomatoes. They tend to be earlier than tomatoes, though. I'm not sure how early Black Nightshade is, but I imagine you can grow them like tomatoes, too. It probably reseeds like a weed. You could probably just smoosh up a berry where you want it to grow the next season. (Or you could save the seeds and plant them like tomatoes.)
To save seeds, use the same method used with ground cherries, tomatillos, and wonderberries, since they're so tiny. Put several berries in a blender with water. Blend them on low for a bit. Let it settle a bit. The seeds should sink to the bottom. Pour out the stuff on the top. Keep working on that until you just have seeds. Then, bag them up in an empty herbal tea bag or some such and let them dry (having a fan going in the room where you dry them is advantageous). Drying on brown paper bags works well. Get some plastic bead bags (like miniature Ziplock bags) to keep them in after they're dry.