As Don_S mentioned in comments:
Probably the overall mass of Loperamide in the package. The POM has 60 mg total of Loperamide, while the OTC has 36 mg at most (18 capsules being the largest package size I saw for Imodium). I don't know what is the mass threshold between POM and OTC medications in the UK, but it's probably between those two numbers (perhaps even closer to 36 mg total weight). Sometimes the decision between POM and OTC is the toxicological potential if someone accidentally (or not) swallows the entire package at once.
This is one possible explanation for the general case. But for example in my jurisdiction 200mg pack of acetylcysteine powder is POM and 600mg tablet is OTC, giving a massively larger dose for the OTC variant. There are certainly some idiosyncrasies to observe. In this case: there is something else at work here.
First of all, Imodium is a brand name and those are usually quite a bit more expensive when compared to generics like the one you linked to.
And there we get closer to the nature of this beast:
The NHS is great service provider and quite tough negotiating with pharmaceutical companies over the prices for drugs.
AMENDMENTS TO THE DRUG TARIFF – March 2018 – For the UK, March 2018
Basic prices of drugs lists loperamide in "Part VIIIA" on page 204
You already mentioned the price. That's the reason. If needed for prescriptions, you1 get the NHS negotiated rebate for the drug in its cheap generic form. Without that prescription the manufacturer of the brand name drug is free to charge what he thinks he can get away with.
Or to turn that around, you need a prescription to get the cheaper drug which is subsidised. It's not about the ingredients or the dangers. It's poltics of price and availability.
There is a culture of secrecy and shame concerning primary care rebate schemes but there are really no good reasons why they should not be adopted in the NHS.
A robustly administered rebate scheme will not have any impact on clinical decision making in the local NHS and can only support the legal requirement for PCTs to make arrangements which are “necessary and expedient” to supply medicines to patients, according to the NHS Act 2006 and the NHS (Pharmaceutical Services) Regulations 2012. As Paul Jerram, head of medicines management at the former Isle of Wight PCT, put it: “As I help GPs manage a budget which is public money I believe that I am ethically obliged to source at the best price. Therefore … I have to support rebates.”
However, in practical terms, NHS bodies are not always willing to consider pharmaceutical industry rebate schemes. Some are concerned that participation in a rebate scheme may undermine their credibility as a healthcare body. Others will not enter rebate schemes because of the generic prescribing agenda in the NHS in general.
For example, some rebate schemes will not be recommended by prescribing optimisation service PrescQIPP because they might advocate branded prescribing, even in cases where branded prescribing is clinically appropriate. Some will claim that rebates are at odds with local formulary and guidance recommendations.
Stephen Goundrey-Smith: "Primary care rebate schemes: win-win partnerships for industry and the NHS", The Pharmaceutical Journal 29 MAY 2013.
Or:
Appendix 1: DH view on Rebate schemes: an extract from an email sent to colleagues on the UK Pharmaceutical Advisors Group November 2012
The Pharmaceutical Price Regulation Scheme (PPRS) is the UK-wide voluntary scheme agreed between Government and the Association of British Pharmaceutical Industry to control the prices of branded medicines supplied to the NHS. Under the terms of the 2009 PPRS agreement (see paragraph 3.4 of the agreement), it states that the Department of Health does not support additional or alternative initiatives by health authorities in respect of the pricing of branded medicines in primary care.
The pricing arrangements under the 2009 PPRS aim to secure value for money for the NHS whilst providing companies with the right incentives to invest in new and effective medicines for the future. The Department's concern is that local rebate schemes potentially undermine the PPRS pricing arrangements but also, it is possible that companies will seek to make good lost revenues from rebate schemes elsewhere, for example by increasing the wholesale price on other medicines or not offering as much discount to community pharmacies. Both of these scenarios could have implications for the community pharmacy contractual framework funding arrangements or lead to higher growth in the NHS drugs bill.
In view of this, Primary Care Organisations (PCO) should look critically at the wider ramifications of any potential rebate schemes on NHS budgets and future NHS service provision before entering into local agreements.
The PPRS does not extend to non-branded medicines or other items which may be prescribed on the NHS; this includes POM medicines. Depending upon the detail of the rebate scheme, it will be important to consider other relevant issues. If a company is offering an arrangement that is of added value to a PCO, for example, it supports implementation of one of the PCO’s prescribing policies, or optimises patient’s use of their medicines, there may be a benefit.
Pharmaceutical Rebate Schemes
1: "You" in this context means someone looking at the database of prices, this is not necessarily the patient in general. It is the cost incurring for the system, that is here: the NHS.