John Stuart Mill is not always as libertarian as people think. After defending free speech vigorously in an earlier chapter, in paragraph 8 of On Liberty “Chapter V: Applications,” he defends the idea of driving vice underground if the people advocating and facilitating it are likely to be advocating and facilitating it primarily for the money. However, he makes an interesting distinction: if paid facilitation is necessary to enable people to pursue vice, it must be allowed. But if home-production is adequate to make the vice possible, then it is legitimate to make the market provision of facilitation illegal in order to drive it underground, where it will be less of a bad influence. Here is what he writes:

There is another question to which an answer must be found, consistent with the principles which have been laid down. In cases of personal conduct supposed to be blameable, but which respect for liberty precludes society from preventing or punishing, because the evil directly resulting falls wholly on the agent; what the agent is free to do, ought other persons to be equally free to counsel or instigate? This question is not free from difficulty. The case of a person who solicits another to do an act, is not strictly a case of self-regarding conduct. To give advice or offer inducements to any one, is a social act, and may, therefore, like actions in general which affect others, be supposed amenable to social control. But a little reflection corrects the first impression, by showing that if the case is not strictly within the definition of individual liberty, yet the reasons on which the principle of individual liberty is grounded, are applicable to it. If people must be allowed, in whatever concerns only themselves, to act as seems best to themselves at their own peril, they must equally be free to consult with one another about what is fit to be so done; to exchange opinions, and give and receive suggestions. Whatever it is permitted to do, it must be permitted to advise to do. The question is doubtful, only when the instigator derives a personal benefit from his advice; when he makes it his occupation, for subsistence or pecuniary gain, to promote what society and the State consider to be an evil. Then, indeed, a new element of complication is introduced; namely, the existence of classes of persons with an interest opposed to what is considered as the public weal, and whose mode of living is grounded on the counteraction of it. Ought this to be interfered with, or not? Fornication, for example, must be tolerated, and so must gambling; but should a person be free to be a pimp, or to keep a gambling-house? The case is one of those which lie on the exact boundary line between two principles, and it is not at once apparent to which of the two it properly belongs. There are arguments on both sides. On the side of toleration it may be said, that the fact of following anything as an occupation, and living or profiting by the practice of it, cannot make that criminal which would otherwise be admissible; that the act should either be consistently permitted or consistently prohibited; that if the principles which we have hitherto defended are true, society has no business, as society, to decide anything to be wrong which concerns only the individual; that it cannot go beyond dissuasion, and that one person should be as free to persuade, as another to dissuade. In opposition to this it may be contended, that although the public, or the State, are not warranted in authoritatively deciding, for purposes of repression or punishment, that such or such conduct affecting only the interests of the individual is good or bad, they are fully justified in assuming, if they regard it as bad, that its being so or not is at least a disputable question: That, this being supposed, they cannot be acting wrongly in endeavouring to exclude the influence of solicitations which are not disinterested, of instigators who cannot possibly be impartial—who have a direct personal interest on one side, and that side the one which the State believes to be wrong, and who confessedly promote it for personal objects only. There can surely, it may be urged, be nothing lost, no sacrifice of good, by so ordering matters that persons shall make their election, either wisely or foolishly, on their own prompting, as free as possible from the arts of persons who stimulate their inclinations for interested purposes of their own. Thus (it may be said) though the statutes respecting unlawful games are utterly indefensible—though all persons should be free to gamble in their own or each other’s houses, or in any place of meeting established by their own subscriptions, and open only to the members and their visitors—yet public gambling-houses should not be permitted. It is true that the prohibition is never effectual, and that, whatever amount of tyrannical power may be given to the police, gambling-houses can always be maintained under other pretences; but they may be compelled to conduct their operations with a certain degree of secrecy and mystery, so that nobody knows anything about them but those who seek them; and more than this, society ought not to aim at. There is considerable force in these arguments. I will not venture to decide whether they are sufficient to justify the moral anomaly of punishing the accessary, when the principal is (and must be) allowed to go free; of fining or imprisoning the procurer, but not the fornicator, the gambling-house keeper, but not the gambler. Still less ought the common operations of buying and selling to be interfered with on analogous grounds. Almost every article which is bought and sold may be used in excess, and the sellers have a pecuniary interest in encouraging that excess; but no argument can be founded on this, in favour, for instance, of the Maine Law; because the class of dealers in strong drinks, though interested in their abuse, are indispensably required for the sake of their legitimate use. The interest, however, of these dealers in promoting intemperance is a real evil, and justifies the State in imposing restrictions and requiring guarantees which, but for that justification, would be infringements of legitimate liberty.