A prison worker caught with class A drugs after investigators discovered she was in a relationship with a gangster inmate has avoided jail.