Potential limits on artistic freedom include (but are not limited to):
Legal limitations: Laws very from nation to nation, state to state, and even from medium to medium. In some areas it is possible to legally buy literature which - if depicted in image/moving image form - would be illegal in the same jurisdiction. Given that our imaginations are powerful quasi-visual devices, this can seem a strange dichotomy, as can the fact that film is at base an authorial work, a script written for the screen.
I'm not sure how you justify your claim that, "Their [artists'] legal duty to the public or state appears to be nil". Try telling the team at Charlie Hebdo that, or the authors of these books, or these [film-makers] (https://en.wikipedia.org/wiki/List_of_banned_films#Bahrain). See also Banned in the USA: The Growing Movement to Censor Books in Schools.
Conscience/harm minimisation: When the artistic instinct is inhibited by potential consequences of realising the work; consequences which can effect not only the audience, but people who have never read the work, and of course, the author themselves.
Imaginative/creative powers: An artist does not always possess the imagination and/or talent to realise their artistic ambition.
Market demand/potential profitability: Transgressive works frequently cause sensation and sell very well, but others are banned or rejected by publishers/outlets.
Fear of consequence: Societal/familial/peer group expectations and repercussions.
Technical ability: EG: lack of sufficient skill to meet artistic aims.
Motivation: The artist often desires the finished work but lacks the drive to see it through to completion.
Can fiction be immoral?
Fiction might be deemed as immoral/moral (although not necessarily) by those who adhere to consequentialism, supernaturalism, utilitarianism, virtue ethics, intuitivism, emotivism, hedonism, subjectivism, deontolgy (duty-based ethics). Each framework contains scope for an artistic work to be deemed 'unacceptable' from a moral standpoint (See the BBC's Introduction to Ethics for an explanation of each view. Upon reading each concise entry, it should become obvious how each morality might exert itself upon artistic work).
People sometimes attribute morality to a work simply because it contains material (such as depictions of sex and violence). Others might argue that depiction of such content is merely reflective of circumstances discoverable in the real world, and that for a work to be immoral, it must advocate for behaviours that are deemed immoral.