Try this:
$(".morelink").click(function(){
// find the initial comment height
var $comment = $(this).parents('.comment');
var initial_height = $comment.height();
if($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
// remove the set height
$comment.removeAttr('style');
var end_height = $comment.height();
// set the current height to the initial height and then animate it to the height after the resulting class change
$comment.css('height', initial_height).animate({height: end_height}, 500);
return false;
});