Flying a plane has a certain fixed cost (it's not weightless or frictionless, so even an empty plane will consume fuel and have wear and tear, the pilot always costs the same).
You also have variable costs (more fuel consumed with more weight, more work in getting people through to the airplane at check-in, etc).
Now if your variable costs are lower than the cost of adding another passenger then you want to add that next passenger. It might be you're still unprofitable on this flight, but this passenger will lessen your financial burden, even if only marginally.
Now it may be that in order to offer flights at competitive prices to destination B from A, it's better cost wise to split it up in two legs via C.
So maybe on route A->(C)->B you are unprofitable, but because you have people booking A->C at a higher price your total becomes profitable.
However you need those unprofitable people on flight A->(C)->B, because otherwise your plane B is half empty and your plane A->C isn't quite full yet. But still you'd rather have more passengers in A->C.
Now people using these Hidden City tricks use your A->C->B ticket to get from A->C.
This destroys your profit margin, because now your flight A->C has just become unprofitable.
Another thing is this might lead to more people booked on C->B not showing up, thus they're flying with a half-empty plane again here, which they may be able to fill up from other sources of C.
Pricing can get quite complex, but it all makes sense at some level if you have the overview.
I have no idea why Lufthansa thinks this is within their rights according to the law, so it will be very interesting to see.