Are relationships allowed between students and faculty? What sorts of restrictions do universities place on romantic or sexual relationships between faculty and graduate students, and what are the underlying issues that motivate these restrictions?

For example, suppose the student has previously taken a class from the professor but has no plans for further academic contact.  What other factors could help determine whether a relationship would be allowed or considered appropriate?
To give one data point on how this issue is actually framed and enforced by universities (or at least public universities in the US), let me quote from my university's Campus Administrative Manual:


  An individual may not initiate or participate in institutional
  decisions involving a direct benefit or penalty to someone with whom
  that individual has had a sexual relationship.
  
  Relationships such as those between supervisors and their subordinate
  employees are inherently asymmetric. Current or past sexual
  relationships can adversely affect decisions, distort judgments, and
  undermine morale. Any university employee who participates in academic
  supervisory or administrative decisions concerning another employee
  with whom he or she has or has had a sexual relationship has a
  conflict of interest in these situations.
  
  Accordingly, no individual shall initiate or participate in
  institutional decisions involving a direct benefit or penalty
  (employment, retention, promotion, tenure, salary, leave of absence,
  etc.) to a person with whom that individual has or has had a sexual
  relationship. He or she must take specific actions to remove himself
  or herself from all decisions and actions that may influence the
  career or status of the other employee.


[...]


  In cases where a conflict [of interest] is identified, the UEO [Unit Executive Officer] must develop a
  Supervisory Relationship Management Plan that redirects
  decision-making and bypasses involved parties. Such procedures must be
  agreed to in writing and approved through all administrative levels.
  For changes in existing positions that might create a supervisory
  relationship in the same unit, review and approval is also required.


[...]


  The appropriate human resources office will conduct periodic
  compliance reviews. Failure to abide by this policy constitutes
  misconduct, subject to discipline under applicable University
  procedures.


tl;dr: Sexual relationships between students and faculty are not per se forbidden, but the conflicts of interest they create — either real or perceived — must be carefully and explicitly managed by multiple layers of campus administration.

It is worth emphasizing that these policies are invoked not only for sexual relationships that are generally considered inappropriate, such as undergraduates and their instructors, or graduate students and their advisors, but also with married (and formerly married) couples.