Photos in Wikipedia influence the way people look at the text, because readers can't escape from an image. That's good, as long as photographs in articles give a clear impression of the subject. (I didn't say "neutral", did I?). Wikimedia Commons has an enormous database of photographs, videos, vector images and sounds. This database now consists of 83 million "freely usable media files to which anyone can contribute". That's nice. It's also a database that anyone can steal images from. Roughly 40 million images in Commons are under a Creative Commons CC-BY license – these images require attribution. The other 40 million images have a public domain license, and are up for grabs. In this piece I will show how things work out, and I will give advice on how to prevent stealing of your images.
Rawpixel Ltd. is a stock image company "operating from its HQ in the UK and its creative hub in Bangkok, Thailand", according to their website. Rawpixel takes images that are in the public domain, removes watermarks, and enhances colours and resolution. Collections used by Rawpixel include paintings & prints by Vincent van Gogh, John James Audubon, Jean Bernard, Benjamin Fawcett, Edwin Landseer, Frederick Sander, May Rivers, Henry Sandham et al.; photographs by NASA and many others. The image near this text is a nice depiction of Ramses II, taken from the book L'histoire de l'art égyptien (1878) by Émile Prisse d'Avennes. Rawpixel generously gives the source: New York Public Library. This version (with the Rawpixel logo) is used 150 times in several Wikipedia versions, though there is a version without the logo (also uploaded to Commons by Rawpixel!). Rawpixel now has >9,000 images in Commons, used 1,500 times in Wikipedia. Nothing wrong with that, because the Rawpixel logo can be removed from the images. The only odd thing is that the authors' field in the metadata is often wrongly identified as "Rawpixel". The original author is, of course, the original painter or photographer; Rawpixel has merely simplified and enhanced these pictures. But Rawpixel is fairly open about their business: they mention the source of their images, and offer three types of accounts for usage: Free, Casual and Business, the last one at $9 a month.
Alamy, on the other hand, is completely different. Alamy harvests public domain images and publishes them on their own website (watermarked: Alamy) without mentioning the original source. They scraped 292 million photos to their website, from various sources, including Wikimedia Commons. Alamy even sends infringement letters and invoices to users of the public domain pictures – sometimes even to the original photographers! Photographer Carol M. Highsmith was sternly told "According to Alamy's records your company doesn't have a valid license for use of the image(s)". Mind you, this warning was about her own photographs, as Alexis Jazz showed in his brilliant piece on Commons: How Alamy is stealing your images.
In 2013 I uploaded a photo of Dutch historian David Cohen to Commons. The original at the Dutch National Archives was a bit frayed, low-res, and had a watermark (number 023 0069, down right). In 2016 I cropped the image a bit, removed the watermark and uploaded a version in higher resolution. Alamy took my version of the photo, upgraded the resolution and now sells it for $11 to $189, depending on intended usage. They bluntly state: "This image is a public domain image, which means either that copyright has expired in the image or the copyright holder has waived their copyright. Alamy charges you a fee for access to the high resolution copy of the image." And of course, Alamy doesn't tell us they took the image from Commons, where anyone can download it freely.
All of this is tantamount to taking your property without your permission: that is, stealing. And yes, you're right: it's legal, with PD images. A public domain image is what it is: public domain. These images are creative works to which no exclusive intellectual property rights apply, so they can be used by anyone, without attribution. Remember – Alamy doesn't sell the original image, they say they charge a fee for access to the high resolution image. Stock image companies can't be prevented from offering public domain images and charging people for usage. But anyone can easily prevent Alamy and the like from selling the images of which they own copyright. Even if you want to stimulate usage of your photographs: just give your photographs a Creative Commons license (CC-BY-SA). Stock image companies don't like to attribute, so they probably won't touch your images. Archives, libraries and museums: if you own copyright on certain collections, please publish them under a CC-BY-SA license, and not in the public domain.