What is loperamide?

"It's a weak opioid agonist that doesn't cross the blood-brain barrier very well," Dr Wetsman says. "It's meant to treat diarrhea by stimulating the opioid receptors of the gut without affecting the opioid receptors in the brain."

"Meant to" being the operative phrase. Some users report effects ranging from moderate sedation to mild euphoria. "Its that down time period where u r very comfortable and relaxed after a huge shot of heroin [sic]," writes a user on Drugs-Forum.com. "idk why its not illegal but fuck heroin i like this better."

So, in short, loperamide is a legal, cheap, readily available opiate substitute. 

Why would anyone want to get high on an anti-diarrhea drug?

Did you read the sentence above this paragraph? That should answer your question, but to break it down further, there are basically two reasons. The first reason is because some people like the experience of being high and will try just about anything to get there. (I used to be that person, back in my robotripping days.) 

The second reason is because they're weaning themselves off opiates. Dr. Wetsman says far more people fall into the latter group than the former. "[People are] seeking to self-medicate opiate withdrawal," he says. "This is happening because there isn't enough treatment available to people."